How to fix “sudo command not found” on Linux

In Linux, the most used keyword is the sudo keyword. Sudo represents the superuser in the Linux system which means that this user gains authority to perform various changes in the system. While utilizing the sudo keyword to perform various tasks on your system, you may encounter the “sudo command not found” problem.

This article will act as a guide for you to learn the reasoning behind this error and also be able to fix it.

Resolve the “sudo command not found” error

There is a very simple reasoning behind this error. In this section, the reason will be elaborated on in great detail and various solutions will be provided as well.

Reason: Missing sudo tool

When Linux is installed onto your system, the sudo command is installed by default as well. Sometimes, due to some issues, the sudo tool might not exist on your system or may get removed. When this happens and you try to run any sudo command, the error is prompted as shown below:

Solution: Install sudo command

how to handle linux files and direc...

Installing the command onto your system is the most suitable method to resolve the error. Firstly to do this you need to enter root user mode. Run this statement in the terminal to enter into root user mode:

$ su -

A sample snippet for the root user is shown below:

Now, use the following command to update your system’s repository:

# apt update

Once the repository is updated, use the following command to install the sudo command on the system:

# apt install sudo

The snippet below shows the successful installation of the sudo command

Once installed, exit the root user by using the exit keyword then try the sudo command again. This time you will not get the error as shown in the below image:

This method has resolved the “sudo command not found” issue.

Conclusion

The problem statement “sudo command not found” occurs when the system does not have the sudo utility installed on it. This can be fixed by going into the root user mode and then installing the sudo tool using the apt repository. This article has provided the knowledge that is required to understand the origin of this error as well as its solutions.