How to check Linux memory usage?

How to check Linux memory usage?

Linux is a very good operating system. There are many distribution of Linux available. Most popular are, RedHat, CentOS, Debian and FreeBSD. The desktop experience has been upgraded a lot. Some times its good to use the terminal to perform the operations faster. Only few very handy and good commands are required. Just understand and remember so that you can get the most out of it. Mostly, the RAM utilization is required to check. You can use many command to check Linux memory usage. A few commands are given as under:

1. free -m

This command will show the output of total memory installed in the system. it will also show the used and free memory. the above command will give the output in mega bytes. if you need to check the gigabytes of memory, replace -m with -g. There are many other switches available for this command. A list of switches for this command is given as under:

-k, to show the memory in kilobytes


-s 10

-l, detailed high low memory size usgae


Linux memory usage

2. /proc/meminfo

This is the dynamic way of checking the memory usage.

MemTotal: Total memory in kB
MemFree: Free memory in kB
MemAvailable: Available memory in kB
Buffers: Buffers kB
Cached: Cached kB
SwapCached: Swap Cached kB
Active: Active memory in kB
Inactive: Inactive memory in kB

3. ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -n

The above command will show the current process running on the system with memory they are using. This will become very handy once you are looking for which process is taking memory and how much. This command will sort the memory usage in ascending and descending order.

4. vmstat -s
This will share the same results like meminfo but with less information.
linux memory usage

5. top
The top command is generally used to check memory and cpu usage per process

linux memory usage