System and processes

The swapoff command

Disables swap memory, returning its contents to RAM.

Syntax

swapoff DISPOSITIVO

Most useful options

-aDisables all swap

Copy-ready examples

$ sudo swapoff /dev/sda2Disable the swap

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

Typical mistakes

  • If RAM is full, disabling swap can slow down or freeze the system.

Related commands

FAQ

When to disable swap?

To repair the partition or before resizing it.

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