Apple changed the usage of the “top” command in Terminal, so my output of processes ordered by CPU usage got broken in GeekTool.
After poking around in Terminal, I found the right recipe, kind of:
top -F -R -l2 -o cpu | grep -v '0.0' | tail -n +19 | grep -v 'PID' | cut -c 1-29
At times it will output some additional information at the top, but this is good enough for me.
I’ve found a better solution. It is:
top -F -R -l2 -o cpu | cut -c 1-29 | grep -v '0.0' | tail -n +19 | grep -v 'PID'
If you want to output processes sorted by memory usage, you can use:
top -F -l1 -o vsize | cut -c 1-24,89-96 | tail -n +12 | head -n 10
The last number 10 indicated number of lines in the list.