Take the 2-minute tour ×

I just got Geektools, and I'm trying to get a shell geeklet to display the command top -F -R -o cpu in the same way that it is displayed in the terminal. Through Google, I found this command to show a bundle of system information:


This has way more CPU information than I want/need. I am hoping to replace the CPU information in the second command with the cleaner first one, but I don't know how to get it to display properly.

share|improve this question
I'm guessing that you want it exactly (or as close as possible) to the output from top? –  daviewales Feb 13 '13 at 13:31
add comment

1 Answer

up vote 1 down vote accepted

Try ps aux. It displays a nice clean output sorted by cpu usage. If you want something even less cluttered, try

ps aux | awk '{print $3 "       " $11}';

To understand this command, just run ps aux, and look at the output. The variable $3 refers to the third column of the output. You can add or remove columns from GeekTool by adding or removing these variables from the command. The large amount of whitespace between the quotation marks just changes the spacing between the columns in the output.

If you want more options, check out the man page by typing man ps. (You can do this for top too. If you're wondering why I didn't suggest a modification using top, it is due to the following issues:

The problem with GeekTool is that it requires output from a command that is static. top can be made to give a static output by using top -l 1, but because it is only making one sample, it can't get the cpu usage. (It needs at least two for that.) You will notice that if you run top -l 1, your cpu usage will be displayed as 0. To rectify that, you can use top -l 2. However this displays the system usage twice, and only the second set of data is correct. This probably wouldn't be helpful for GeekTool. If you still really want to use top, you can try out the following command: top -l 2 -o cpu -R -stats cpu,command. However, it will only display the incorrect data, because it prints that first.

share|improve this answer
add comment

Your Answer


