How To Check Memory Usage on Linux

In this article, we want to teach you How To Check Memory Usage on Linux.

There are a lot of tools for checking memory usage on Linux systems.

Some are commonly used commands like free and ps while others are tools like the top that allow you to display system performance stats in different ways.

How To Check Linux Memory Usage

In this guide, we’ll look at some commands that can be most helpful in identifying the users and processes that are using the most memory.

You need to log in to your server as a root or non-root user with sudo privileges.

Now follow the steps below to see how to check your memory usage with commonly used Linux commands.

Find Linux Memory Usage with /proc/meminfo file

/proc/meminfo reports current memory usage on your system, along with some other information about your memory. It’s a read-only file.

To see the memory information, you can use the following commands on your Linux system:

$ cat /proc/meminfo
$ less /proc/meminfo
$ more /proc/meminfo
$ egrep --color 'Mem|Cache|Swap' /proc/meminfo

In your output you will see:

MemTotal: 2035208 kB
MemFree: 1338780 kB
MemAvailable: 1747356 kB
Cached: 488904 kB
SwapCached: 0 kB
SwapTotal: 523260 kB
SwapFree: 523260 kB

Use free command to Monitor Linux Memory Usage

The free command provides information about the total amount of the physical and swap memory, as well as the free and used memory on Linux.

To see the free memory size in MB, you can use the command below on Linux:

free -m

In your output, you will see something similar to this:

        total  used   free  shared  buff/cache  available
Mem:    1987    101   1307    22       578       1706
Swap:   510      0    510

Also, you can use the command below to see the total memory on your Linux system:

free -t -m
      total   used   free   shared  buff/cache  available
Mem:   1987    103    1305     22      578        1704
Swap:  510      0     510
Total: 2498    103    1816

Let’s understand the free outputs.

In the mem section you see the total, used, free, shared, buff/cache, and available columns.

Total: The total RAM installed on your server.

Used: The total RAM used on your server.

Free: The total free memory on your server.

Shared: Amount of memory mostly used by the tmpfs file systems.

Buff/cache: It is the sum of buffers and cache. Buff is the amount of memory used by the Linux kernel for buffers. The cache is the memory used by the page cache and slabs.

Available: The total memory available to start new applications without swapping on your Linux system.

In the swap section, you see the total, used, and free columns.

Total: The total swap partition or file installed on your server.

Used: The total swap space used.

Free: The free swap space on your server.

Here is the list of the most commonly used options for free command:

-h: human-readable output.

-b, -k, -m, -g: display output in bytes, KB, MB, or GB.

-l: show detailed low and high memory statistics.

-o: use old format (no -/+buffers/cache line).

-t: see the total for RAM + swap usage on Linux.

-s: update every [delay] seconds.

-c: update [count] times.

Show Linux Memory Usage with vmstat command

Virtual memory statistics reporter, also known as vmstat, is a Linux command-line tool that reports various bits of system information. Things like memory, paging, processes, IO, CPU, and disk scheduling are all included in the array of information provided.

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 1337684 61272 531972 0 0 2 7 53 57 0 0 100 0 0

Show Linux Process with top command

The top command is used to show the Linux processes. It provides a dynamic real-time view of the running system.

Usually, this command shows the summary information of the system and the list of processes or threads that are currently managed by the Linux Kernel.

top - 09:01:55 up 18:41, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 88 total, 1 running, 86 sleeping, 1 stopped, 0 zombie
%Cpu(s): 0.2 us, 0.3 sy, 0.0 ni, 99.2 id, 0.0 wa, 0.0 hi, 0.2 si, 0.2 st
MiB Mem : 1987.5 total, 1305.9 free, 101.9 used, 579.8 buff/cache
MiB Swap: 511.0 total, 511.0 free, 0.0 used. 1706.4 avail Mem

16452 root 20 0 12160 6944 6120 S 0.7 0.3 0:00.02 sshd
16449 root 20 0 11704 3688 3184 R 0.3 0.2 0:00.03 top
1 root 20 0 102804 12320 8200 S 0.0 0.6 0:10.03 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par+

To exit from the top command you can type the q.

Monitor System Resources with atop command on Linux

The atop command is a tool for monitoring system resources in Linux. It displays tons of information related to the amount of load on the system’s resources at the process level.

On Debian / Ubuntu, you can use the command below to install it:

apt install atop

On Centos / RHEL, you can use the command below to install it:

yum install atop

Now type the command below in your terminal:


Another way to check your memory usage and its information is to use the htop command.

Check Linux Memory Size with htop command

htop command in a Linux system is a command-line utility that allows the user to interactively monitor the system’s vital resources or server’s processes in real time.

htop supports mouse operation, uses color in its output, and gives visual indications about the processor, memory, and swap usage.



At this point, you learn to check your memory usage on your Linux system with some commonly used Linux commands.

Hope you enjoy it.

May this article about How To Use Bash wait Command on Linux be useful for you.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!