LinuxMoz

Linux Stuff && Coffee

Linux Memory Usage Command

| Comments

How to display Linux memory usage on all versions of Linux from the command line. The command free displays the Linux memory info (Virtual memory & physical) the system is currently using including Linux cache memory and swap usage.

To display the memory usage type:

1
free -m

(the -m is optional, it displays the data in Mb’s instead of Kb’s – I personally find this easier).

Linux Memory Usage Command Example

Linux memory info output from free should look similar to this:

1
2
3
4
5
[email protected]:/# free -m
             total       used       free     shared    buffers     cached
Mem:           995        956         39          0         65        734
-/+ buffers/cache:        156        838
Swap:          475          0        475

Below is an overview of what each memory value means:

Mem This is real memory (RAM).

Swap This is memory that the Linux Kernel has swapped out to disk to free up RAM (faster memory), if you are a Windows Admin you would call this “Virtual Memory”.

Total This show the total memory for Linux Swap and RAM.

Used Shows the total Linux memory usage for the system, this is often confused and many admins often think there system is out of memory.

Free Displays the free memory Linux has.

Buffers Buffers are needed for inter-process communication, such as accessing disks etc a certain amount of memory has to be left in buffers.

Cached Cached memory is basically a buffer used in RAM for applications to use, it is perfectly normal for free to display a low memory usage and a high cache value.

Comments