7 commands to test memory usage and swap space in Debian 10

Swap space (called swap in Windows) is part of the hard drive, but it is used as RAM for faster processing. It is used when the physical memory is full.

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

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

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

  1. Free team
  2. Swapon team
  3. Top team
  4. Vmstat team
  5. Top team
  6. Htop command
  7. Team Views

Free team

You can check the total, used and free swap space with the free command. The result will be displayed in kilobytes. The command is as follows.

free

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

free -h

Free command output in a readable format

Swapon team

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

swapon -s

Use swapon command to see swap usage

Top team

At the top there is a command that displays a lot of parameters, including operating time, number of users logged in, average load, number of running, sleeping or stopped tasks, number of zombie processes, CPU loading, available / used physical memory and swap space. ,

Open a terminal and do the following.

top

The fifth heading above will show you statistics about swap space.

Check swap usage with the top command

Vmstat team

Using the vmstat command, you can view paging and extraction information, as shown in the following screenshot. The team should look like this.

vmstat

Check swap with vmstat

The atop command

The atop command is similar to the top command, which also provides swap space information.

If the command is not available on your system, follow these steps on a terminal with root privileges to install it.

apt-get install atop

Wait for the operation to complete.

Perform the following on the terminal.

atop

Use the atop command to see swap usage

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

Htop command

The Linux htop command is another useful command, the same as the top and atop command. Along with other information, it can also show the use of swap space.

If the command is not available on your system, follow these steps on a terminal with root privileges to install it.

apt-get install htop

Wait for the team to finish.

Perform the following on the terminal.

htop

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

Check swap usage with htop

Team Views

Glances is another beautiful tool that can give you information about swap space usage. If the tool is not available on your computer, run the command below to install it. Make sure you have root privileges.

apt-get install glances

Once the tool is installed, run the following command on the terminal.

glances

The fourth column shows the use of swap space, as shown in the following screenshot.

Check memory usage with the Glances command

The following are some of the commands that you can use to check the swap space on Linux, and they should be useful in troubleshooting system problems. Good luck !!

7 commands to check memory usage and swap space in Debian 10

Sidebar