Check if Swap Memory is Enabled on Linux

Check if Swap Memory is Enabled on Linux

Swap memory is a disk-based storage area that Linux can use when physical RAM is not sufficient for running processes. Before troubleshooting memory-related issues, it can be useful to verify swap status on the system. This tutorial explains how to check if swap memory is enabled on Linux.

The swapon --show command can be used to display active swap areas and their current usage.

swapon --show

Output example:

NAME      TYPE SIZE USED PRIO
/swapfile file   4G   0B   -2

The output confirms that swap is enabled on the system. In this example, /swapfile is configured as a 4 GB swap area, with no swap space currently in use.

If swap is not active on the system, the swapon --show command does not display any output.

Leave a Comment

Cancel reply

Your email address will not be published.