Learn how to turn off all swap immediately and when this is the right move for troubleshooting or maintenance. 25.01.2026 | reading time: 3 min Swap can change performance and behavior; sometimes you need it off now. Follow the commands below to disable every swap device or file temporarily and observe the system state immediately. A quick live demo Run these commands to see and disable swap; observe the before and after output as shown: ```bash $ swapon --show NAME TYPE SIZE USED PRIO /swapfile file 2G 0B -2 $ free -h total used free shared buff/cache available Mem: 15G 2G 11G 100M 2G 12G Swap: 2G 0B 2G $ sudo swapoff -a $ swapon --show # no output means swap is disabled $ free -h total used free shared buff/cache available Mem: 15G 3G 10G 100M 2G 11G Swap: 0B 0B 0B ``` When to do this now Disable swap immediately when you need to reproduce a memory pressure bug, perform live memory tests, migrate memory state, or when instructed by support; do it with `sudo` and monitor RAM, because the system will rely entirely on physical memory until swap is re-enabled. Making it persistent or reversible To re-enable swap without reboot use `sudo swapon -a`; to keep swap off across boots comment out swap lines in `/etc/fstab` and remove any resume settings in your bootloader if hibernation is used, but remember this changes system behavior long term. Safety and monitoring Before turning swap off, check available RAM with `free -h` and active swap with `swapon --show`; watch `dmesg` and `top` or `htop` for OOM killer activity after disabling swap, and be ready to re-enable if processes start failing. Next practical steps Try the demo on a non-production machine or during a maintenance window, then practice re-enabling swap and editing `/etc/fstab`; mastering these steps helps in troubleshooting and in preparing systems for special workloads like low-latency or high-memory applications. For certification-oriented learning, explore deeper topics like memory management, the boot process and kernel parameters; consider exam preparation through focused courses such as CompTIA Linux+ or LPIC-1 at bitsandbytes.academy to turn practice into proof of skill. Join Bits & Bytes Academy First class LINUX exam preparation. utilities storage processes troubleshooting boot-process