commands

swapon — Inspect or activate swap

List active swap with --show. Activation changes live memory backing and is not part of this lab. An empty list can indicate no active swap. Use a fresh private workspace; live operations are VM-only.

Formal Syntax & Structure

linux syntaxlinux
swapon --show[=columns]

Parameters & Attributes

NameTypeDescription
--show[=columns]optionRequired for this read-only form; optionally specify comma-separated output columns using an equals sign. Do not supply a device operand.

Return Value

exit status and output

The --show operation prints active swap entries and selected columns. A successful empty listing can mean no active swap; it is not an activation test.

Working Example

Example Snippetlinux
swapon --show=TYPE,SIZE,USED,PRIO
Linux Reference