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:

kbd { display: inline-block; margin: 0 .1em; padding: .1em .6em; font-family: Arial,”Helvetica Neue”,Helvetica,sans-serif; font-size: 11px; line-height: 1.4; color: #242729; text-shadow: 0 1px 0 #FFF; background-color: #e1e3e5; border: 1px solid #adb3b9; border-radius: 3px; box-shadow: 0 1px 0 rgba(12,13,14,0.2), 0 0 0 2px #FFF inset; white-space: nowrap;}
  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

Fig.01: free command in action

2. /proc/meminfo

Use cat command as follows:
cat /proc/meminfo

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

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 – interactive process viewer in action

(adsbygoogle = window.adsbygoogle || []).push({});

Posted by: SXI ADMIN

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....

How to Start and Enable Firewalld on CentOS 7

In this article, we discuss how to start and enable firewalld. It is highly recommended that you have a firewall protecting your server.Pre-Flight CheckThese...