Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
    
Perfect. [extra chars] –  Nathan Greenstein Jan 9 '11 at 17:34
    
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
add comment

2 Answers

up vote 3 down vote accepted

You can also use this sysctl:

sysctl -n vm.loadavg
share|improve this answer
    
That's perfect. I'm using mankoff's answer, and will continue to, but this answer is the closest to what I was asking. Thanks! –  Josh Jan 23 '13 at 23:40
add comment

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 }'
share|improve this answer
    
Awesome, thanks! My screen is happy now :-) –  Josh Jan 9 '11 at 18:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.