If you want to quickly see what processes are wasting all of your memory, you can do so with a simple command line that filters the output from ps to sort by memory usage, and return only the ten biggest memory hogs.
Naturally, you could use the top command instead, but this is an alternative way to do it:
ps aux | sort -nrk +4 | head
The sort -nrk +4 command is where the magic happens… the -n stands for numeric, the -r is for reverse, and -k starts the sorting on the 4th column in the output. Lastly we pass it through head to just return the first 10 in the list.
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 07/21/10