Fix ‘Bash Sudo: Command Not Found’ on Linux / Linux / Debian / Fix ‘Bash Sudo: Command Not Found’ on Linux

The sudo command in Linux allows you to run commands as another user (it is most commonly used to run a command with elevated privileges as root). In some cases, when you try to run a command with sudo, an error message is displayed:

-bash: sudo: command not found

-bash: sudo: command not found

The most common reason is that the sudo command is not installed in your Linux distro. You can use the built-in su command to run a command as root in Linux. For example:

$ su -c 'du /'

You can also open an interactive bash shell as root:

$ su -

If the sudo command is unavailable in your Linux distro, you can install it using the built-in package manager.

Switch to privileged root session:

$ su -

Install sudo on RHEL, Fedora, CentOS, Oracle/Rocky Linux:

$ dnf install sudo

On RHEL, Fedora, CentOS, Oracle/Rocky Linux:

$ apt install sudo

Then add the user to the sudo group:

$ usermod -aG sudo sysops1

This user can now run commands via sudo.

To check that a user has been added to the sudo group, run the following command

$ id sysops1

Check that you are allowed to run any command in the /etc/sudoers file:

$ visudo


/etc/sudoers - allow to run sudo command

Check the contents of the PATH environment variable if bash still cannot find the sudo command.:

$ echo $PATH

Make sure it contains at least the following paths:


Add the paths manually if not.

$ export PATH=$PATH:/usr/bin
Leave a Reply

Your email address will not be published. Required fields are marked *