Forrest logo
back to the swapon tool

swapon:tldr:b569a

swapon: Get swap information.
$ swapon -s
try on your machine

The swapon -s command is used to display the current swap space usage on a Linux system.

Here is an explanation of each part of the command:

  • swapon is a command-line utility in Linux used to enable and disable swap spaces on the system.
  • -s is an option or argument that stands for "summary". It is used to display a summary of the swap space usage.

When you run swapon -s, the command will provide a summary of the swap space usage, including the path of the swap devices or files, their type, size, and usage statistics (amount of used and free swap space). It can also show any zram devices if they are being used as swap space.

The output of the command will look something like this:

Filename                Type            Size    Used    Priority
/dev/sda2               partition       2047996 0       -2

In the example above, the swap space is located on the /dev/sda2 partition with a size of 2047996, and it is currently not being used ("Used" column shows 0). The priority column is a value assigned to each swap space, and it determines the order in which they are used when multiple swaps are available.

The swapon -s command is useful to quickly check the status and usage of swap spaces on a Linux system.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the swapon tool