Swap usage matters when a Linux host feels slow, starts paging during a workload, or needs a handoff that proves whether memory pressure is real. Checking both allocated swap and current swap traffic avoids treating an old swapped-out page the same as active disk-backed memory churn.
The free command gives the quick total, while swapon --show identifies the active swap file, partition, or device behind that total. The kernel also exposes the same swap areas through /proc/swaps, which is useful when scripts or support notes need raw fields instead of a formatted table.
Swap in use does not always mean the system is under pressure at that moment. The vmstat si and so columns show whether pages are moving in and out of swap during the sample window, so the final decision should combine the static USED value with the live swap-in and swap-out rates.
Steps to check Linux swap memory usage:
- Show overall memory and swap totals.
$ free -h total used free shared buff/cache available Mem: 11Gi 851Mi 7.3Gi 29Mi 3.7Gi 10Gi Swap: 4.0Gi 0B 4.0Gifree reads /proc/meminfo. The Swap row shows total configured swap, currently used swap, and unused swap.
- List active swap areas.
$ swapon --show NAME TYPE SIZE USED PRIO /var/lib/swap file 4G 0B -2
NAME identifies the file, partition, or device, and USED shows how much swap is consumed on that specific area. No rows means the system has no active swap area.
- Compare the raw kernel swap table when an exact source table is needed.
$ cat /proc/swaps Filename Type Size Used Priority /var/lib/swap file 4194300 0 -2
/proc/swaps reports sizes and usage in KiB. For human checks, swapon --show is usually easier to read.
- Watch live swap movement during the workload.
$ vmstat 1 3 procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu------- r b swpd free buff cache si so bi bo in cs us sy id wa st gu 1 0 0 7689036 679540 3247912 0 0 17 1205 449 0 0 0 100 0 0 0 1 0 0 7689036 679540 3247912 0 0 0 0 236 321 0 0 100 0 0 0 0 0 0 7689036 679540 3247912 0 0 0 0 83 80 0 0 100 0 0 0
si is swap read from disk per second, and so is memory written to swap per second. Sustained non-zero values during normal workload point to active memory pressure.
- Read raw memory counters when the totals need a kernel-level cross-check.
$ cat /proc/meminfo MemTotal: 12235216 kB MemFree: 7685656 kB MemAvailable: 11359760 kB ##### snipped ##### SwapCached: 0 kB ##### snipped ##### SwapTotal: 4194300 kB SwapFree: 4194300 kB Zswap: 0 kB Zswapped: 0 kB ##### snipped #####
SwapTotal and SwapFree explain the free totals. SwapCached shows pages that were swapped out, read back into memory, and still remain backed by swap.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.