This is an old revision of the document!
check out uptime
. Sample output:
11:34:56 up 9 days, 3:24, 5 users, load average: 3.08, 4.04, 14.66
and since i'm sure you forgot: load is “processes waiting for cpu time to execute”, the 3 numbers are “in the last minute”, “in the last 5 minutes”, and “in the last 15 minutes”. (i think). theoretically, if that number is less than the number of cores that you have, you have resources to spare for more.
anyway, let's get one of those numbers. Here's the regular expression
^.*load average: (([\d\.]){3,}).*$
Here's (uptime piped to) the sed command:
uptime | sed 's/^.*load average: \(\([0-9.]\)\{3,\}\).*$/\1/'
\d
.$1
, it's \1
.