How to Fix: sudo Command Not Found Error

2 min

Here’s how you can fix the “sudo command not found” error in Debian, Ubuntu and other distros.

sudo not found

Sometimes, when you set up or install Linux distributions for the first time, you get the “sudo command not found” error while trying some commands with sudo.

The sudo command is an abbreviation of “superuser do”, and it is a program which allows a user to execute a command with admin privileges. The sudo command helps you run programs/commands like an admin user.

Also, the user, who is running the command with sudo must be a part of the sudo group.

The primary reason you get this error is that the package itself is not installed. However, most modern Linux distribution provides this by default, but some don’t.

Here are the steps you should follow to fix it.


  • First, install the sudo package to fix the problem. Open a terminal, refresh your system and run the following commands to install sudo.

For Ubuntu, Debian and related distros:

su -
apt update
apt install sudo

For Arch Linux:

pacman -S sudo

For Fedora, RHEL, etc:

su -
dnf update
dnf install sudo
  • After the above installation is complete, you have to add the user to sudo group using the following command

usermod -aG sudo <yourusername>

  • Then run the visudo from the terminal and the following line. Press CTRL+O and CTRL+X to save & exit.
Updating the sudoers file using visudo
Updating the sudoers file using visudo
  • Log off and log in again to reflect the change.


After the above change, if you are still getting the error, then follow the below steps.

Make sure your $PATH variable contains the proper path to the sudo executable. If the sudo is installed, but the $PATH is incorrect, you can also get this error. Ideally, your path should contain all the below paths.

echo $PATH

To change the path variable, use the following command. For example, if the /usr/bin is not present, then you can add it via below

export PATH=$PATH:/usr/bin

Then log out and log in to see the effect.

Wrapping Up

I hope this guide helps you to fix the sudo error in your Linux distros. The apparent solution is quite simple, really.

Drop a note below if it helps/or if you have any questions.



Creator of All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest Most Voted
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x