How to Check Realtime RAM Memory Usage Available in Linux VPS



rhelOn the previous post, i have teach you on how to check the memory usage on linux virtual Private Server (VPS) but only top command had provide real-time information and updates . This quick post will covers on how to check realtime RAM memory usage available in Linux VPS using watch command. Watch runs command repeatedly, displaying its output change over time or at regular intervals. Watch will run until interrupted. This command has been tested on Redhat Linux Enterprise 6 (RHEL 6) and may working on CentOS 6.x as well.

The basic syntax of watch is :

# watch [option(s)] command

1. Check memory usage using “top” command. Watch command not required for top command as top will update the result periodically. :

[root@rhel6 ~]# top

2. Check memory usage using “/proc/meminfo” with watch command :

[root@rhel6 ~]# watch -n 1 cat /proc/meminfo

Output :

Every 1.0s: cat /proc/meminfo                                               Mon Oct 15 13:48:17 2012

MemTotal:        1031320 kB
MemFree:          626372 kB
Buffers:           58576 kB
Cached:           217004 kB
SwapCached:            0 kB
Active:           148516 kB
Inactive:         164708 kB
Active(anon):      37816 kB
Inactive(anon):       84 kB
Active(file):     110700 kB
Inactive(file):   164624 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:        141256 kB
HighFree:            280 kB
LowTotal:         890064 kB
LowFree:          626092 kB
SwapTotal:       2064376 kB
SwapFree:        2064376 kB
Dirty:                 4 kB
Writeback:             0 kB
AnonPages:         37652 kB
Mapped:            19096 kB
Shmem:               264 kB
Slab:              81048 kB
SReclaimable:      62096 kB
SUnreclaim:        18952 kB
..
..
..

3. Check memory usage using “free” with watch command :

[root@rhel6 ~]# watch -n 1 free

Output :

Every 1.0s: free                                                            Mon Oct 15 13:47:26 2012

             total       used       free     shared    buffers     cached
Mem:       1031320     404548     626772          0      58564     217004
-/+ buffers/cache:     128980     902340
Swap:      2064376          0    2064376

4. Check memory usage using “vmstat” with watch command :

[root@rhel6 ~]# watch -n 1 vmstat

Output :

Every 1.0s: vmstat                                                          Mon Oct 15 13:46:44 2012

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 626280  58552 217004   30    0     0    14   46   73  0  1 98  1  0

As always if you need any help you can reach us on twitter @ehowstuff or drop us a comment below. Jumping through archives page to read more articles..

Related Articles

Leave a Reply