The sudo command is used to execute applications with root privileges. Sometimes, when trying to use the sudo command, it will give an error message that says sudo: command not found.

This can be frustrating if you are using the sudo command for something important like updating packages or installing programs. Here are some ways to fix this problem and get back up and running.

Method 1: Check Path to sudo

By default, sudo should be installed on your Linux system. If not, it’s possible sudo is not in your path for some reason.

Use the exact path to sudo by running:

$ /usr/bin/sudo -V
-bash: /usr/bin/sudo: No such file or directory

If you get the error above, it means sudo isn’t installed in your system. If so, continue with the next method.

If the above command works, it could mean that your PATH variable is incorrect. Find out what is your current PATH variable:

echo $PATH

If /usr/bin is missing from your PATH variable, update it by adding /usr/bin to your current PATH variable.

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Adjust the PATH variable to what you currently have listed when you type echo $PATH.

Method 2: Install sudo

The command sudo is a much-needed tool when working in Linux. If you type something like sudo fdisk -l, only to find out that it doesn’t work because of an error such as “sudo: Command not found,” your distribution may not have this essential module installed.

To find out for sure, type the following command:

$ whereis sudo

If you don’t get the output above, the sudo program is not installed.

If you’re on Debian, you install sudo by first logging in as root by typing this command:

su -

Another option is to hold down the Ctrl + Alt + F1 key combination to switch to a text terminal. Log in as username root and specify the password for the root user. After logging in, there should appear # at the command prompt.

So, if you have a Linux system based on the apt package manager, then run this command to update the system package list.

apt update

The next step is to install sudo on your system.

apt-get install sudo -y

Those who are using Fedora, Red Hat Linux, CentOS, and Scientific Linux, can type this command:

yum install sudo

You want to add your username to the sudo group, so your user has sudo rights. Change username to your user (e.g., jeff).

usermod -aG sudo username

At the root prompt, you need to add yourself to the sudoers file at /etc/sudoers by running:


When you see the text editor, enter the line below.

%sudo ALL=(ALL) ALL

If you’re using the vi editor, type :wq to exit and save the file. If you’re using the nano editor, press Ctrl + O key combination to save the file and Ctrl + X key combination from exiting the nano editor.

After you’re done, reboot your computer for changes to take effect.


Regarding permissions, the root user can do whatever they want. However, for these commands and changes to be made securely, you need either a sudo or an account with administrator privileges.

We’ve discussed solutions involving checking if sudo is installed and installing sudo manually if it isn’t installed.

Tim Miller

Tim has always been obsessed with computers his whole life. After working for 25 years in the computer and electronics field, he now enjoys writing about computers to help others. Most of his time is spent in front of his computer or other technology to continue to learn more. He likes to try new things and keep up with the latest industry trends so he can share them with others.

Leave a Comment