I am working hard on my talk for FOSDEM, and don’t have much time to write detailed posts, so you’ll have to put up with me and be contempt with this “one liners” series 😉
In a memory shortage situation, it’s handy to understand which processes are memory hogs. Not only the ps command can tell you that: it can even return the process list sorted by memory occupation. At that point, getting the “top N” is a piece of cake. The following example shows the top 3 on my machine this morning, after shutting down and restarting a few of them:
bronto@brabham:~$ ps -e -o pid,user,rss,vsz,args --sort -vsz | head -n 4 PID USER RSS VSZ COMMAND 27971 bronto 213896 3099640 /usr/bin/python /usr/bin/hotot 27884 bronto 44572 2306604 liferea 24470 bronto 202724 2164244 /usr/bin/gnome-shell
Hope it helps!