Installation | Topics | Beyond Lino

Analyzing RAM usage

These are just my personal notes. No warranty whatsoever.

Show available memory:

$ free -h

To show the top memory using processes, run top and then hit M to sort them by memory usage.

Show active processes sorted by memory usage in percent:

$ ps -o pid,user,%mem,command ax | sort -b -k3 -r

Or:

$ ps aux --sort '%mem'

Or a command that uses awk to sum up the total memory used by processes of the same name:

$ ps -e -orss=,args= |awk '{print $1 " " $2 }'| awk '{tot[$2]+=$1;count[$2]++} END {for (i in tot) {print tot[i],i,count[i]}}' | sort -n

Thanks to