How to check Memory (RAM) usage in Linux OR different ways to check RAM usage in Linux?
Memory OR widely known as RAM is known to be one of the important component on the server which make sure the tasks performed on your server are processed fast enough. Higher the availibility of physical memory, more stable is your server during high resource usage processes.
Linux offer various tools to check Memory/RAM usage of your server such as free, top, sar, vmstat etc using which you can deside whether to optimize softwares to use less memory OR whether it’s time to upgrade memory on the server.
1) ‘free’ command: one of the easiest way to check the RAM usage:
free -m
will display physical memory as well as Swap
free -m -t
same as above but it will display the total of physical and swap memory at the bottom.
2) ‘top’ command: The top command displays the real time values of the running system and are continously updated (by default 3 seconds). The two rows “Mem and Swap” displays the total, used and free amount of RAM/Swap. Though the values displayed are in kbs and not human readable, it is just one another way to check the usage.
3) ‘sar’ command: is included in the ‘sysstat’ package and is not installed by default. To install ‘sysstat’ package, execute:
yum install sysstat
Once ‘sysstat’ package is installed, start the service
service sysstat start
sysstat package when installed, provider ‘sar’ command which collects system activity information and saves it in a file before displaying it on a standard output.
sar -r
displays Memory/Buffer/Swap information horizontally.
4) /proc/meminfo file: which displays everything about the RAM on your server.
Related Links:
How to find out CPU utilization in Linux?
Once ‘sysstat’ package is installed, start the service
service sysstat start
Comments are closed.