Investigating RAM usage (How to see Linux RAM Usage)

When your projects grow you are bound to have situations where you want to find out which process is using most of the RAM. There are multiple ways to investigate this. We’ll look into following commands/files.

  1. top
  2. /proc/meminfo
  3. free


top -o %MEM
top command (Sorted by Memory Usage)

Simplest and quickest command to see this is “top” you can type above on your terminal to see the list of processes sorted by the amount of RAM they are using.

This will show something like this


awk '$3=="kB"{$2=$2/1024**2;$3="GB";} 1' /proc/meminfo | column -t
/proc/meminfo in GB

Linux also stores this information in a file called /proc/meminfo. You can run the command above to see details of RAM availability by going through that file.

This will show something like this


free -m
free -h
RAM and Swap space info

Some times you also want to see Swap space usage. You can use free -m  and free -h to see that info

This will show something like this