Linux Command - free

free - Display amount of free and used memory in the system.

Syntax

1
free [OPTIONS]

Options

Common Option Description
-b, –bytes show output in bytes
-k, –kibi show output in kibibytes
-m, –mebi show output in mebibytes
-g, –gibi show output in gibibytes
-h, –human show human-readable output
-l, –lohi show detailed low and high memory statistics
-t, –total show total for RAM + swap
-s N, –seconds N repeat printing every N seconds
-c N, –count N repeat printing N times, then exit
-w, –wide wide output

Examples

Show free and used memory

Show in Human readable output

1
free -h

Sample output

1
2
3
4
             total       used       free     shared    buffers     cached
Mem: 7.7G 5.1G 2.6G 654M 542M 2.1G
-/+ buffers/cache: 2.5G 5.2G
Swap: 2.0G 0B 2.0

Show output in mebibytes

1
free -m

Sample output

1
2
3
4
             total       used       free     shared    buffers     cached
Mem: 7881 5229 2652 663 542 2161
-/+ buffers/cache: 2525 5356
Swap: 2047 0 2047

Show free and used memory, refresh every 5sec

1
free -m -s 5

Reference