Tue 03 Apr 2007

Emulating top for GeekTool

There are lots of stupid solutions for GeekTool's inability to use top (or other keep-running tools).

Here's my easy solution:
ps -axcr -o pid,%cpu,command,rsz,state | head -n 15 | awk '$5!=ps'
Explained:
  • Use ps to generate a list of running processes, for all users, and sort them by CPU usage.
  • Only print the given columns.
  • Take the top 15.
  • Remove any entries for ps itself.
You don't need to run top multiple times, start a Python interpreter, or any other silliness.

Posted at 2007-04-03 19:29:47 by RichardLink to Emulating top for …