Hack 89. Free command examples

by Ramesh

Free command displays all the necessary information about system physical (RAM) and swap memory.

  1. Syntax: free [options]

What is the total RAM on my system?

In the example below, the total physical memory on this system is 1GB. The values displayed below are in KB.

  1. # free
  2. total used free shared buffers cached
  3. Mem: 1034624 1006696 27928 0 174136 615892
  4. -/+ buffers/cache: 216668 817956
  5. Swap: 2031608 0 2031608

What is the total memory on my system including RAM and Swap?

In the following command:

  • option m displays the values in MB
  • option t displays the “Total” line, which is sum of physical and swap memory values
  • option o is to hide the buffers/cache line from the above example.
  1. # free –mto
  2. total used free shared buffers cached
  3. Mem: 1010 983 27 0 170 601
  4. Swap: 1983 0 1983
  5. Total: 2994 983 2011