Useful Commands to Check RAM Memory Usage and Installed RAM in Centos Machine.

By | April 1, 2022

1-The below command will show you ,How much RAM is installed in your computer.

[root@localhost ~]# cat /proc/meminfo
MemTotal:       28459120 kB
MemFree:        26640436 kB
MemAvailable:   27011524 kB
Buffers:            2296 kB
Cached:           673640 kB
SwapCached:            0 kB
Active:           456056 kB
Inactive:         324872 kB
Active(anon):     105620 kB
Inactive(anon):    33436 kB
Active(file):     350436 kB
Inactive(file):   291436 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:      14352380 kB
SwapFree:       14352380 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:        105036 kB
Mapped:            56104 kB
Shmem:             34064 kB
Slab:             127928 kB
SReclaimable:      71040 kB
SUnreclaim:        56888 kB
KernelStack:        4048 kB
PageTables:        12416 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    28581940 kB
Committed_AS:     792536 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      335348 kB
VmallocChunk:   34358943740 kB
Percpu:             2176 kB
HardwareCorrupted:     0 kB
AnonHugePages:     22528 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      273580 kB
DirectMap2M:     3729408 kB
DirectMap1G:    27262976 kB
[root@localhost ~]# 

2-Free command will show you the total free memory amount, physically used and swap memory.

[root@localhost ~]# free -m -h       
              total        used        free      shared  buff/cache   available
Mem:            27G        1.0G         25G         33M        729M         25G
Swap:           13G          0B         13G
[root@localhost ~]# 

3-The top command is used to display memory and buffers information.

[root@localhost ~]# top
top - 16:30:29 up 22:14,  1 user,  load average: 0.00, 0.01, 0.05
Tasks: 179 total,   1 running, 178 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni, 99.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 28459120 total, 26640408 free,  1071708 used,   747004 buff/cache
KiB Swap: 14352380 total, 14352380 free,        0 used. 27011520 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                     
  514 root      20   0       0      0      0 S   0.3  0.0   0:26.68 xfsaild/dm-0                
13156 root      20   0 3722672  26872   5392 S   0.3  0.1   0:14.88 OlaServer                 
    1 root      20   0  193828   7004   4200 S   0.0  0.0   0:07.85 systemd                     
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.03 kthreadd                    
    4 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H                
    5 root      20   0       0      0      0 S   0.0  0.0   0:08.20 kworker/u16:0               
    6 root      20   0       0      0      0 S   0.0  0.0   0:00.15 ksoftirqd/0                 
    7 root      rt   0       0      0      0 S   0.0  0.0   0:00.22 migration/0                 
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh                      
    9 root      20   0       0      0      0 S   0.0  0.0   0:33.35 rcu_sched                   
   10 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 lru-add-drain               
   11 root      rt   0       0      0      0 S   0.0  0.0   0:00.39 watchdog/0                  
   12 root      rt   0       0      0      0 S   0.0  0.0   0:00.31 watchdog/1                  
   13 root      rt   0       0      0      0 S   0.0  0.0   0:00.25 migration/1                 
   14 root      20   0       0      0      0 S   0.0  0.0   0:00.06 ksoftirqd/1                 
   16 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/1:0H                
   18 root      rt   0       0      0      0 S   0.0  0.0   0:00.28 watchdog/2                  
[root@localhost ~]# 

4-The vmstat command is used to see the memory statistics in which the user can view some additional information related to processes, block IO, traps, paging, and CPU activity.

[root@localhost ~]# vmstat -s
     28459120 K total memory
      1072568 K used memory
       456876 K active memory
       324796 K inactive memory
     26639372 K free memory
         2296 K buffer memory
       744884 K swap cache
     14352380 K total swap
            0 K used swap
     14352380 K free swap
        35835 non-nice user cpu ticks
           25 nice user cpu ticks
        23867 system cpu ticks
     64068895 idle cpu ticks
         8760 IO-wait cpu ticks
            0 IRQ cpu ticks
          147 softirq cpu ticks
            0 stolen cpu ticks
       330917 pages paged in
       594141 pages paged out
            0 pages swapped in
            0 pages swapped out
     11900232 interrupts
     11915693 CPU context switches
   1648730744 boot time
        15302 forks
[root@localhost ~]# 
[root@localhost ~]# 

5-This below command will show you the more information of memory .

[root@localhost ~]# lshw -short -C memory
H/W path              Device         Class          Description
===============================================================
/0/1/3                               memory         64KiB L1 cache
/0/1/4                               memory         256KiB L2 cache
/0/1/5                               memory         10MiB L3 cache
/0/2/6                               memory         64KiB L1 cache
/0/2/7                               memory         256KiB L2 cache
/0/2/8                               memory         10MiB L3 cache
/0/6                                 memory         28GiB System Memory
/0/6/0                               memory         8GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/6/1                               memory         8GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/6/2                               memory         4GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/6/3                               memory         8GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/6/4                               memory         [empty]
/0/6/5                               memory         [empty]
/0/6/6                               memory         [empty]
/0/6/7                               memory         [empty]
/0/6/8                               memory         [empty]
/0/6/9                               memory         [empty]
/0/6/a                               memory         [empty]
/0/6/b                               memory         [empty]
/0/6/c                               memory         [empty]
/0/6/d                               memory         [empty]
/0/6/e                               memory         [empty]
/0/6/f                               memory         [empty]
/0/6/10                              memory         [empty]
/0/6/11                              memory         [empty]
/0/6/12                              memory         [empty]
/0/6/13                              memory         [empty]
/0/6/14                              memory         [empty]
/0/6/15                              memory         [empty]
/0/6/16                              memory         [empty]
/0/6/17                              memory         [empty]
/0/23                                memory         128KiB BIOS
[root@localhost ~]# 

Leave a Reply

Your email address will not be published. Required fields are marked *