Q. How do I find out System / Server Memory Utilization under RHEL / CentOS / any other Linux distribution?
A. You need to use free command which, displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
free command example
Type the free command at shell prompt:
$ free
$ free -m
Output:
total used free shared buffers cached Mem: 2010 1965 45 0 152 776 -/+ buffers/cache: 1036 974 Swap: 2047 137 1910
vmstat command
vmstat command provides more information :
$ vmstat
Output:
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 140480 43636 158196 797692 1 0 108 220 1 4 7 5 87 1 0
Understanding vmstat memory options
- swpd: the amount of virtual memory used.
- free: the amount of idle memory.
- buff: the amount of memory used as buffers.
- cache: the amount of memory used as cache.
- inact: the amount of inactive memory. (-a option)
- active: the amount of active memory. (-a option)
$ vmstat -a
Output:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free inact active si so bi bo in cs us sy id wa st
0 1 140480 37376 109516 1730040 1 0 108 220 1 4 7 5 87 1 0The following command displays one new line of utilization data every second
$ vmstat 1
The following command displays one new line per 2 second, but only for the next 10 seconds:
$ vmstat 2 10
Output:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free inact active si so bi bo in cs us sy id wa st 4 0 139216 23508 130644 1723680 1 0 108 220 1 5 7 5 87 1 0 2 0 139216 23252 130668 1723816 0 0 0 410 3242 11472 9 7 84 0 0 1 0 139216 23120 130656 1724012 0 0 0 750 3280 11592 3 6 90 1 0 0 0 139216 22996 130588 1724180 0 0 0 426 3272 11052 2 5 93 0 0 2 0 139216 20988 129932 1726980 0 0 6 1146 3353 12105 14 9 74 2 0 1 0 139216 20244 129900 1727216 0 0 0 392 3238 11752 8 7 85 0 0 1 0 139216 20120 129868 1727352 0 0 0 444 3197 11173 2 5 93 0 0 1 0 139216 25964 129852 1721044 0 0 0 268 3147 9269 1 4 95 0 0 3 0 139216 25964 129748 1721196 0 0 2 132 3199 10540 1 4 95 0 0 1 0 139216 25964 129676 1721332 0 0 0 456 3213 10608 2 4 93 1 0
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -


{ 6 comments… read them below or add one }
Hi Vivek,
How can I know the memory usage for a particular process in Linux.
Thank you,
Vijay
Thank’s a lot yar…………thank’s
Hi Vivek
What is the difference between free memory and inactive memory
Thanks
sujith
Inactive memory is the pages that are used or allocated for some other processes earlier, but not in use now. Hence if it exhausts on free memory it will utilize form this set. The only advantage of inactive pages is, it saves time if the same page ( that is in inactive set ) is needed, it can be used without bringing in the page. If you want to reduce the inactive page, do as following:
dd if=/dev/urandom of=/tmp/test_file bs=20M
Now after writing for 1-2 GB of file, stop dd and delete it. You can see the respective amount of mem being added to free from inactive. Though this is not suggested as you might be losing the inactive pages, which can become valuable for other processes when they start.
wow.. thank you sreeharsha!. your trick solved my problem.
how to increase the file descriptor values in linux. . .