Starting with Ubuntu 17.04, the swap partition is replaced with a swap file, which makes it easy to be resized.

NOTE: Most of the commands below will require root privilege.

You can check your current swap size with

swapon -s

or

free -h

By default, the swapfile is /swapfile with file mode 600 and it belongs to the root user.

ls -lh /swapfile

If you …