ubuntu 20.04 disable swap permanently code example Example: ubuntu turn off swap sudo swapoff -a && sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab