16

On all linux boxes /proc/loadavg contains the raw load for 1, 5, and 15 minutes. Nothing extra. On OS X machines this file does not exist.

Is there a file or a terminal command which will give me the 1, 5 and 15 minute load averages under OS X, similar to /proc/loadavg on Linux? I know top and w display the load averages but they have a lot more information too. I want just the load averages.

  • This answer isn't for the command line, so I'm including it as a comment. Consider something like iStat menus for monitoring load average and other vitals monitoring (warning: this is a commercial app, and no I don't work for the developer). It integrates some really nice graphical displays in the menubar for OSX: bjango.com/mac/istatmenus . – whaley Jan 9 '11 at 19:58
  • Thanks @whaley, but I wanted this for the statusbar of GNU screen, for when I SSH into my mac. – Josh Jan 10 '11 at 1:17
19

You can also use this sysctl:

sysctl -n vm.loadavg
| improve this answer | |
16

Take the commands you know (top, uptime, w, etc.) and use other tools to reduce to just the data you want.

An example for w:

w | head -n1 | cut -d":" -f4

An example for uptime:

uptime | cut -d":" -f4- | sed s/,//g

An example of loads.d:

sudo loads.d | awk '/./ { printf "%.2f %.2f %.2f\n", $7, $8, $9 }'
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .