echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Category: VPS Management

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Make the swapfile persistent across reboots by adding it to /etc/fstab

Without this, the swapfile is inactive after each reboot. Add this line to /etc/fstab to automatically activate swap on startup.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.