Jail usage

From wikinotes

Basics

# basics
jls                         # list all jails
jexec ${jail}               # enter jail
service jail start ${jail}  # start jail

jexec ${jail} <command>          # run command in jail
jexec ${jail} -u will <command>  # run command as user in jail

for jid in $(jls | tail +2 | awk '{ print $1 }'); do yes | sudo pkg -j $jid -y upgrade; done

jls

jls -s                                      # list all avail jail headers on all jails
jls -h jid name osrelease path | column -t  # print some info

scripts

# print jails, and their configured vnet ip addresses
cat /etc/jail.conf | awk '/(^[a-zA-Z0-9_]+) {/ { foo=$1; getline; print foo " " $3 }' | column -t