Linux - Free command (Memory)

> Operating System - Kernel (Windows, Unix, Linux) > Linux / Unix

1 - About

Free is a linux command that display amount of free and used memory in the system

[root@ebs121 ~]# free
             total       used       free     shared    buffers     cached
Mem:       3042768     427420    2615348          0      49816     301648
-/+ buffers/cache:      75956    2966812
Swap:      2031608          0    2031608
  • The Mem: row displays physical memory utilization,
  • The Swap: row displays the utilization of the system swap space,
  • The -/+ buffers/cache: row displays the amount of physical memory currently devoted to system buffers (Linux Buffer)
Advertising

3 - Syntax

free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V]

Where:

  • -b,-k,-m,-g show output in bytes, KB, MB, or GB
  • -l show detailed low and high memory statistics
  • -o use old format (no -/+buffers/cache line)
  • -t display total for RAM + swap
  • -s update every [delay] seconds
  • -c update [count] times
  • -V display version information and exit

4 - Example

free -g | awk '/Mem:/ {print "Physical Memory: " $2 " GB."} /cache:/ {print "Resident: " $3 " GB."}'
Physical Memory: 266 GB.
Resident: 217 GB.

5 - Documentation / Reference

  • For more information about how to interpret the output of this command correctly, see SAP Note 1382721.
Advertising