If you have tried to run the sudo command on your Linux system and are greeted with a sudo command not found error, we have the solution for you. This error most commonly occurs on minimal installs, such as in Docker or on a VPS (virtual private server), and can happen on any Linux distro, like Ubuntu Linux and Debian . In this tutorial, we will show you how to resolve the error and give you the ability to run sudo commands without error.
In this tutorial you will learn:
- How to install the
sudosoftware package - How to add a user to the
sudogroup

| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | Any Linux distro |
| Software | sudo |
| Other | Privileged access to your Linux system as root or via the sudo command. |
| Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
sudo command not found – Solution
The
sudo command is used to execute commands with root permissions, without actually having to log in to the root account. Any users that have sudo permissions essentially have root administrative access on your Linux system.
- To resolve the error, the first thing you will need to do is login to the root account.
$ su -
- Next, install the
sudosoftware package with the appropriate command below.Debian, Ubuntu: # apt update && apt -y install sudo Fedora, Red Hat, AlmaLinux: # dnf install sudo Arch Linux, Manjaro: # pacman -S sudo
On arch linux and Manjaro systems, the package manager pacman is used to install sudo.
- After the package has installed, you will need to add your regular user to the
sudogroup in order for them to have access to thesudocommand and root permissions. On Red Hat systems, it will be called thewheelgroup instead. The following example will add userlinuxconfigto the group.# usermod -aG sudo linuxconfig Or on Red Hat systems: # usermod -aG wheel linuxconfig
- You should now be able to execute commands with root permissions. Change to your normal user and test.
# su linuxconfig $ sudo whoami root
If you encounter any problems, you may need to reboot and try thesudocommand again.
Closing Thoughts
In this tutorial, we saw how to resolve the sudo command not found error on a Linux system. This involved installing the sudo package. Remember to add all users that will need root permissions to the sudo or wheel group.