How to Use the free -m Command

When working with Linux systems, you’ll often use the “free -m” command to check system memory usage. Let’s learn how to interpret the data displayed by this command.

free -m

[oracle@iZ~]$ free -m

             total       used       free     shared    buffers     cached
Mem:         64427      63259       1168          0        291      59909
-/+ buffers/cache:       3059      61368
Swap:            0          0          0
 

Mem: Represents physical memory statistics.
-/+ buffers/cached: Represents cache statistics for physical memory.
Swap: Represents the usage of the swap partition on the hard drive.

Row 1 Mem:
total: Total physical memory.
used: Total amount allocated for caches (including buffers and cache), but some of these caches may not actually be in active use.
free: Unallocated memory.
shared: Shared memory, typically not used by the system and not discussed here.
buffers: Amount of buffers allocated by the system but not currently in use.
cached: Amount of cache allocated by the system but not currently in use. The difference between buffer and cache is explained later.
total = used + free   

Row 2 -/+ buffers/cached:
used: This is the used value from the first row minus buffers and cached. It represents the total memory actually in use.
free: The sum of unused buffers and cache plus unallocated memory. This is the current actual available memory of the system.
Note: This needs to be interpreted in two parts: -buffers/cache and +buffers/cache
(-buffers/cache), i.e., used memory: The Mem row’s used – buffers – cached
(+buffers/cache), i.e., free memory: The Mem row’s free + buffers + cached
As you can see, -buffers/cache reflects the memory genuinely consumed by programs, while +buffers/cache reflects the total memory that can be reallocated.

Leave a Comment

Your email address will not be published.