jail resources oneliner

Getting a quick overview of the resources currently assigned to your your jails can be done using the following command sequence:

top -Pajnojid | tail -n 20 | awk '{if ($2!=0) print $0}'

Starring in order of appearance:
top; with the flags P -Show info per CPU, a -get command name from argv[] and not the name of the executable, j -display jail id, n -non interactive mode, ojid -the order flag `o` followed by jid for sorting.
tail; to get the last 20 lines of output (skip the sys info)
awk; print all lines where column 2 is not `0`

if you have many jails and hence many jail processes you might want to bump up the number of lines a bit like follows to show a maximum of 50 processes instead of the default 20:

top -Pajnojid 50 | tail -n 52 | awk '{if ($2!=0) print $0}'

Share

Leave a Reply

Your email address will not be published. Required fields are marked *