Skip to content

Instantly share code, notes, and snippets.

@PieterScheffers
Last active December 17, 2015 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PieterScheffers/1bb0512c0719e67b2e7f to your computer and use it in GitHub Desktop.
Save PieterScheffers/1bb0512c0719e67b2e7f to your computer and use it in GitHub Desktop.
FreeBSD - Find updates for programs in jails
# portmaster need to be installed in all jails
jls | grep -v JID | tr -s " " | cut -d' ' -f2 | xargs -I {} sh -c 'echo {} && jexec -U root {} portmaster -L | grep New | cut -d: -f2'
# jls # list jails
# grep -v JID # get all lines without JID in it (-v is negation)
# tr -s " " # replace multiple newlines with one
# cut -d' ' -f2 # split string on newlines and select part 2
# xargs -I {} sh -c '' # split string on newlines and spaces into argument list, then use {} as argument placeholder, then execute sh -c command
# sh -c '' # execute sub-shell with commands in string
# echo {} # output argument (placeholder = jailnumber)
# jexec -U root {} cmd # execute command in jail
# portmaster -L # get list of installed ports
# grep New # find lines with 'New' in it
# cut -d: -f2 # split string on colon and select part 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment