Recently I came up with a script to quickly print the memory utilization of specific processes on Linux. It’s very simple, but proven to be very handy while I was moving and tuning my VPSs. It quickly showed me that Apache was taking pretty much all my memory and motivated the migration to nginx.

It’s currently set to get the Resident Set Size (RSS), but you can easily change it to use Virtual Memory (VSZ). Just change ‘rss’ to ‘vsz’ in the ps commands. Also, you can add more processes to the script. Just add a new line and change the process name.

[gist id=5217833]