System and processes

The swapon command

Enables swap memory and shows which one is in use.

Syntax

swapon --show | swapon DISPOSITIVO

Most useful options

--showShows the active swap
-aEnables all swap from fstab

Copy-ready examples

$ swapon --showActive swap

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • It needs sudo to enable devices.

Related commands

FAQ

How much swap do I need?

A common rule is equal to or twice the RAM on small machines.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course