Linux distros have several features baked in to ensure complete safety and security of the system. Among these, there are some related to user accounts. For instance, by default, a user account on a Linux OS has limited privileges and cannot perform certain administrative actions, such as accessing certain sections of the OS or executing certain files. On Linux, some actions can only be performed by the root user, or you can use the 'sudo' command for them.

What is Sudo in Linux? This command, which stands for 'superuser do' lets you perform actions by giving you root-level permissions. Apart from this, sudo is a package installed on most Linux systems by default.

However, if you've just set up a new Linux system, you may run into the 'Sudo: Command Not Found' error. This is quite common, and you can fix the problem quite easily using different methods, which we shall be discussing here.

Why Are You Getting The 'Sudo: Command Not Found' Error?

To run commands as the root user, you need the Sudo package, which comes pre-installed on most Linux distributions. However, if you are running Arch, Fedora, CentOS, RHEL 8 or later, and Debian 10 or later, it may not be installed. This is one possible reason why you may be getting the error.

Another reason might be that the sudo directory is missing from your system's PATH variable. PATH refers to an environment variable used to search for a command in Linux without specifying its complete path. A missing sudo directory means your system cannot locate and use it.

There are two ways by which you can solve the above problems. The first involves installing the sudo package, and the second, adding sudo to the PATH variable.

1. Install the Sudo Package

To install Sudo, you need to log out of your user account and log in as the root user. Alternatively, you can simply switch to the root user directly by following these steps.

  1. Click on the terminal icon on the panel to open it.
  1. When the terminal opens up, type sudo su before pressing the 'Enter' key.
  1. Pressing the 'Enter' key will cause Mint to ask for your password. So, type it in and press the 'Enter' key again.
  1. Now you have root user privileges. Type apt install sudo and press the 'Enter' key if you are on a Debian-based distro.

    For Arch Linux, the command is pacman -S sudo.

    For RHEL-based distros, use yum install sudo.

    For Gentoo, type emerge --ask app-admin/sudo.
  1. This will install the sudo package on the system. In case it is already installed, you will get a message indicating the same.
  1. Next, type usermod -aG sudo followed by your username to add your user account to the sudo group and press the 'Enter' key.

    The command for Arch, Fedora, and RHEL-based systems is usermod -aG wheel username.
  1. You will see that your username has been added to the sudo group, allowing you to run sudo commands without the 'Sudo: Command Not Found' error.
  1. Now all you need to do is type exit in the terminal and press the 'Enter' key to switch back to your regular user account.

2. Add Sudo to the Path Variable

If sudo is installed on your Linux system but does not work, here is how you can add it to the PATH variable.

  1. Open the terminal and type which sudo before pressing the 'Enter' key. This will show you where sudo is located.
  1. Next, type echo $PATH and press the 'Enter' key again.
  1. To add sudo to the PATH variable, type export PATH=$PATH:/usr/bin and press the 'Enter' key. However, this is a temporary solution that will stop working once you close the terminal.
  1. To prevent that, open your file browser, which will open in your Home directory by default. Use the shortcut Ctrl + H to view hidden files.
  1. Locate the .bashrc file and double-click on it. It will open in a text editor.
  1. Go to the bottom of the file and type export PATH=$PATH:usr/bin: before using the Ctrl + O shortcut to save it.

Now when you use 'sudo' for any commands, such as installing, updating, or removing applications, you won't run into the 'command not found' error.


By following the above fixes, you can easily fix the 'Sudo: Command Not Found' error on Linux. However, when switching to the root user, be careful when performing actions through it since the root user has complete access to the entire system. Improper use of the privileges that the root user has can damage your OS, and you may need to reinstall it completely. That is why we recommend switching back to your regular user account as soon as you have added it to the sudo group.