How to check memory on Debian Linux

How do I check free and used memory on Debian Linux system using the command line option?

Random Access Memory (RAM) is the memory in the computer that is used to store running process and data. RAM provides faster data access as compared to the disk drive. This page shows how to find out the amount of free and used memory in the Debian Linux system.

Check memory Debian Linux

The procedure to check memory is as follows:

  1. Open the terminal app or login to the remote Debian server using ssh command:
    ssh user@server-name-here
  2. Type the free command to see memory in mebibytes:
    free -m
  3. You can also /proc/meminfo:
    cat /pro/meminfo

Let us see all commands to check memory usage on Debian Linux cloud or bare metal server.

1. free command

Display the amount of memory in bytes:
free -b
Show the amount of memory in mebibytes:
free -m
Get the amount of memory in megabytes:
free --mega
Find the amount of memory in gibibyte:
free -g
Want to see the amount of memory in gigabytes? Pass --giga option as follows:
free --giga
Pass the -t option to get totals info about memory:
free --giga -t

Check memory Debian Linux with free command

Fig.01: free command in action

2. /proc/meminfo

Use cat command as follows:
cat /proc/meminfo

meminfo command to check memory usage on Linux

This file reports statistics about memory usage on the system. It is used by free to report the amount of free and used memory (both physical and swap) on the system as well as the shared memory and buffers used by the kernel

3. top command

Just type top command:

top command to get linux memory usage in percentage

top command displays Linux processes including CPU and memory/swap usage

4. vmstat command

To get report about virtual memory statistics on Debian Linux, run:
vmstat 2 5
vmstat -a

vmstat command

Get info about processes, memory, paging, block IO, traps, disks and cpu activity.

Understanding memory output of vmstat

  • 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)

htop command

Install htop using apt command/apt-get command:
sudo apt install htop
Now run it:

htop command showing memory usage on Debian Linux

htop – interactive process viewer in action

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • Ram Oct 29, 2017 @ 18:17

    Easy to follow guide. thanks!

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum