A concise how-to to create and enable swap without rebooting, shown with real commands and outputs. 26.01.2026 | reading time: 2 min Running out of RAM in the middle of a job is a real pain; adding swap at runtime buys time and prevents OOM killers from terminating processes, and I'll show exactly how to do that now. Quick practical example Follow these commands to add a 1 GiB swapfile and verify it; this is copy-paste ready: ```bash $ free -h total used free shared buff/cache available Mem: 3.8G 3.1G 100M 12M 700M 500M Swap: 0B 0B 0B $ sudo fallocate -l 1G /swapfile || sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 $ sudo chmod 600 /swapfile $ sudo mkswap /swapfile Setting up swapspace version 1, size = 1 GiB (1073741824 bytes) no label, UUID=1111-2222 $ sudo swapon /swapfile $ swapon --show NAME TYPE SIZE USED PRIO /swapfile file 1024M 0B -2 $ free -h total used free shared buff/cache available Mem: 3.8G 3.0G 200M 12M 600M 700M Swap: 1.0G 0B 1.0G ``` Tweaks and persistence After enabling swap you can tune behaviour with `sysctl vm.swappiness=` and check priority with `cat /proc/swaps`; to make the swapfile persistent add the line "/swapfile none swap sw 0 0" to `/etc/fstab` and test it with `sudo swapoff /swapfile` then `sudo swapon -a` to confirm the entry works. Other tools worth knowing Besides the basic flow, tools and kernels features like `zram` for compressed in-RAM swap, `systemd-swap` for automated swapfile management, and `meminfo` inspection via `/proc/meminfo` come in handy when a manual swapfile isn't the right answer. Final note and next steps Adding swap at runtime is fast, reversible, and often safer than killing processes; practice the steps, learn the tuning knobs, and consider studying deeper system internals — for structured exam preparation consider CompTIA Linux+ or LPIC-1 and intensive courses at bitsandbytes.academy to level up your Linux skills. Join Bits & Bytes Academy First class LINUX exam preparation. storage processes troubleshooting