Categories: DebianLinuxShell

7 Commands to Check Memory Usage and Swap Space in Debian 10

Swap space (which is known as paging in Windows) is part of the hard disk but it used as RAM for faster processing. It is utilized when a physical RAM is full.

In this article, I am going to show you seven commands that can be used to check memory usage and swap space in Debian 10.

How to check memory usage and swap space usage in Debian 10

There are following six commands you can use to check the swap size in Debian 10.

  1. The free command
  2. The swapon command
  3. The top command
  4. The vmstat command
  5. The atop command
  6. The htop command
  7. The glances command

The free command

You can check the total, used and free swap space with the help of free command. The result will be displayed in kilobytes. The command looks like the following.

free

If you want to check the swap space in human-readable format with the closest possible unit, use the -h switch as follows.

free -h

The swapon command

You can use the swapon command to check the swap space on a particular partition, logical volume or a file. Here is the complete command.

swapon -s

The top command

The top is a command which shows many parameters including the uptime, the number of users logged in, average load, the number of tasks running, sleeping or stopped, the number of zombie processes, CPU utilization, available/used physical memory and swap space.

Open up the terminal and execute the following.

top

The fifth header from the top will show you the stats about swap space.

The vmstat command

With the help of vmstat command, you can view the swap in and out information as shown in the following screenshot. The command should look like the following.

vmstat

The atop command

The atop command is just like a top command which also gives information about swap space.

If the command is not available on your system, execute the following on terminal with root privileges to install it.

apt-get install atop

Wait for the operation to complete.

Execute the following on a terminal.

atop

The fifth header shows the information about swap space as shown in the above screenshot.

The htop command

The Linux htop command is another useful command just like top and atop command. Along with other information, this can also show the swap space utilization.

If the command is not available on your system, execute the following on terminal with root privileges to install it.

apt-get install htop

Wait for the command to finish.

Execute the following on the terminal.

htop

The third column gives information about swap space as shown in the following screenshot.

The glances command

Glances is another pretty tool that can give you information about swap space utilization. If the tool is not available on your machine, execute the below command to install it. Make sure you have root privileges.

apt-get install glances

Once the tool has been installed, run the following command on the terminal.

glances

The fourth column shows the swap space utilization as shown in the following screenshot.

So the following were some of the commands you can use to check swap space in Linux and they should be helpful in troubleshooting the system. Good luck!!

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago