Sort top by CPU Usage to Make it More Useful

May 13, 2011 - 4 Comments

sort top processes by CPU

The top command is a great way to get a quick overview of how your system is performing and how apps are using your resources, if you are unfamiliar with it, it’s basically a command line task manager like Activity Monitor. My big complaint with top is that the default setting doesn’t sort processes by CPU, which for me is one of the most useful ways to detect an errant process. This is easily resolved by adding a flag to top though:

top -u

or

top -o cpu

Alternatively, you could just install htop for Mac OS X through MacPorts or Homebrew. htop is superior to top in many ways, but because it requires additional software to install many users might not want to bother with it.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: William Pearson in Command Line, Tips & Tricks

4 Comments

» Comments RSS Feed

  1. Antoine says:

    ‘top -u’ is shorter and does the job.

  2. Bigmoof says:

    Or while in top, you can interactively sort the order by pressing o, then the key, e.g. press ocpu gets ordering by CPU usage. Other e.g. keys :

    pid
    command
    time
    ports
    uid
    vsize
    ppid

    etc.

  3. glonek says:

    Wow, thanks a billion for this info! Top author should be ashamed for not providing any of this.

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates