19

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.

2
  • 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
    Commented Jan 9, 2011 at 19:58
  • Thanks @whaley, but I wanted this for the statusbar of GNU screen, for when I SSH into my mac.
    – Josh
    Commented Jan 10, 2011 at 1:17

2 Answers 2

24

You can also use this sysctl:

sysctl -n vm.loadavg
0
18

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 }'
0

You must log in to answer this question.

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