I would like to check the memory usage of current linux system, How to view the memory usage information in centOS 7? This post will show you how to check the memory usage using the following command:
#1 free command – this command will display the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. the memory information is gathered by parsing /proc/meminfo file.
#2 system monitor tool – this is a GUI program to use to view the cpu usage, memory usage of current processes.
CentOS 7 check memrory usage using “free” command
To list the amount of free and used memory on your system, just type “free” command:
free
Outputs:
[root@osetc /]# free total used free shared buffers cached Mem: 1010860 934976 75884 8280 0 107944 -/+ buffers/cache: 827032 183828 Swap: 2129916 138000 1991916
This command will gather the memory information by parsing the /proc/meminfo file. Using “cat” command to view the memory information:
cat /proc/meminfo
Outputs:
[root@osetc /]# cat /proc/meminfo MemTotal: 1010860 kB MemFree: 75184 kB MemAvailable: 103136 kB Buffers: 0 kB Cached: 116740 kB SwapCached: 10096 kB Active: 284496 kB Inactive: 432848 kB Active(anon): 221640 kB Inactive(anon): 387300 kB Active(file): 62856 kB Inactive(file): 45548 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 2129916 kB SwapFree: 1991948 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 591796 kB Mapped: 44504 kB Shmem: 8312 kB Slab: 111916 kB SReclaimable: 60120 kB SUnreclaim: 51796 kB KernelStack: 4192 kB PageTables: 30180 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 2635344 kB Committed_AS: 2966816 kB VmallocTotal: 34359738367 kB VmallocUsed: 163076 kB VmallocChunk: 34359553388 kB HardwareCorrupted: 0 kB AnonHugePages: 428032 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 102272 kB DirectMap2M: 946176 kB DirectMap1G: 0 kB
The free command will display the amount of memory in kilobytes by defaultm, if you want to display the amount of memory in megabytes, issue the following free command with “-m” option, type:
free -m
Outputs:
[root@osetc /]# free -m total used free shared buffers cached Mem: 987 914 72 8 0 106 -/+ buffers/cache: 807 179 Swap: 2079 134 1945
CentOS 7 check memory usage using the system monitor tool
To start “system monitor” tool, click “Application“->”system tools” ->”system monitor“, then system will pop-up a “system monitor” window. This tool is similar with the “Task Manager” in the windows operating system.
Or type the “gnome-system-monitor” command, enter:
gnome-system-monitor
system will pop-up “system monitor” window, swithc to “Resources” tab, you will see that the amount of memory usage and memory history.