All Articles

Make OSX's top behave like Linux's top

OSX’s top program doesn’t quite behave like its Linux counterpart out of the box. For me, the two biggest problems are that processes aren’t sorted by CPU usage and the top program itself uses 10% of the CPU because it calculates all sorts of statistics about memory and shared library usage that I personally don’t care about.

There are a series of flags that you can pass to OSX’s top to have its behavior be closer to Linux’s top. I have created the following alias to that effect :

alias mytop='top -s1 -o cpu -R -F'

The display is updated every second, processes sorted by CPU usage and no unnecessary statistics are calculated. Instead of 10%, top uses only 2% of the CPU.

Published Jan 23, 2009

I am a computer scientist specializing in building machine learning powered products. I’m currently a machine learning developer at Local Logic.

4 thoughts on "Make OSX's top behave like Linux's top"

fread2281

Commented 2011-11-16 08:27:53

<blockquote cite="#commentbody-633">

<strong><a href="#comment-633" rel="nofollow">Micah Stupak</a> :</strong>

Hello, thanks for this as I had been trying to figure out some good settings for OS X top for a while. Do you know if it is possible to use interactive mode, though? (Sorry to leave a comment on an old blog post.)

</blockquote>

try htop, its on homebrew and macports.

these settings are for interactive mode, though.

Micah Stupak

Commented 2011-11-16 13:15:40

Oh, thanks for the tip on htop. Got it off macports and it's exactly what I'm looking for.

Micah Stupak

Commented 2011-11-04 12:58:59

Hello, thanks for this as I had been trying to figure out some good settings for OS X top for a while. Do you know if it is possible to use interactive mode, though? (Sorry to leave a comment on an old blog post.)

Rob

Commented 2012-06-26 21:00:11

A quick note: this segfaults on 10.6. :)