Pages

Linux Check Memory Usage


How do I check used and free RAM memory usage under Linux operating systems using command line and GUI tools?

Linux comes with different set of commands to check memory usage. The free command displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The vmstat command reports information about processes, memory, paging, block IO, traps, and cpu activity. Finally, you can use the top command which provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.

free command


Display free memory size in MB:

$ free -mOutput:

             total       used       free     shared    buffers     cached
Mem:           750        625        125          0         35        335
-/+ buffers/cache:        254        496
Swap:          956          0        956
 
Displays a line containing the totals memory in MB:
$ free -t -m
Output:

       total       used       free     shared    buffers     cached
Mem:           750        625        125          0         35        335
-/+ buffers/cache:        253        496
Swap:          956          0        956
Total:        1707        625       1082
 

vmstat command


Type vmstat command at shell prompt:

$ vmstat
Output:

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
1  0      0 131620  35432 341496    0    0    42    82  737  1364 15  3 81  1
 

top command


Type top command at the shell prompt:
$ top
Sample outputs:


Fig.01: top command displaying used memory

To exit from top command type q key. Read man page of free, vmstat, top command for more information.

GNOME Desktop: GUI Tool



The Gnome System Monitor application enables you to display basic system information and monitor system processes, usage of system resources, and file systems. You can also use System Monitor to modify the behavior of your system. You can start System Monitor by visiting System menu > Choose Administration > System Monitor option. Or type the following command at the shell prompt:

 
gnome-system-monitor
 
 
Sample outputs:


Fig.02: Linux See Memory Usage With GUI System Monitor Tool