You can monitor swap usage in Linux using several command-line tools. Here are a few methods:
Using the
freecommand:free -hThis command displays memory and swap usage in a human-readable format.
Using the
swaponcommand:sudo swapon --showThis command shows the swap space currently in use, including the size and usage of each swap file.
Using the
topcommand:Run the
topcommand:topIn the output, you will see a summary of memory and swap usage at the top of the screen.
Using the
vmstatcommand:vmstat 1This command provides a continuous report of system performance, including swap usage, updated every second.
Using the
htopcommand (if installed):Simply run:
htopThis interactive process viewer shows memory and swap usage in a graphical format.
You can choose any of these methods based on your preference for monitoring swap usage.
