How To Check Memory Usage On Linux With 3 Commands

How To Check Memory Usage On Linux With 3 Commands

It is very important to check memory usage on servers to prevent resources from falling short. If you run a busy website, you need to make sure the server has enough free memory to serve the visitors to the site. If not, the site will become painfully slow or even go down when there is a traffic spike. In this article we will show you 3 common Linux commands to check memory usage and memory used per process.

1. free -m

free -m command is the most simple and easy way to check memory usage on Linux. This command displays all data in MBs. Let’s take a look at the example below

How to check memory usage on Linux with free -m command

The output is pretty self explanatory, there are 256 MB RAM installed on the system, 87 MB has been used, 168 MB is free.

2. vmstat -s

vmstat -s command lays out more detailed memory usage statistics than the free -m.

How to check memory usage on Linux with vmstat -s command

3. top

top command is usually used to check memory and cpu usage per process.

How to check memory usage on Linux with top command

Header section of output shows the system wide usages, and the detail section shows usage per process. Press q to exit the top command output.

That’s all, we hope this article helped you learn the commands to check memory usage on Linux.

You May Also Like