swapon command not found

In this troubleshooting guide we learn how to fix swapon command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

swapon: command not found

or when using sudo you get the following error message

sudo: swapon: command not found

Solutions to swapon: command not found

How To Fix swapon: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu swapon is provided by mount package.

mount is:

This package provides the mount(8), umount(8), swapon(8), swapoff(8), and losetup(8) commands.

To fix this problem, we can install more using the command below.

sudo apt-get -y install mount

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install mount.

sudo apt -y install mount

Or if you have aptitude installed you can use the following command.

sudo aptitude install mount

Summary

In this tutorial we learn how to fix swapon command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.