If you are seeing the error "-bash: sudo: command not found" when trying to run the sudo
command on a Linux system, it means that the sudo
command is not installed or not in the system's search path.
The sudo
command allows you to run commands with superuser privileges. It is typically installed by default on most Linux distributions.
To fix the "command not found" error, you will need to install the sudo
package. On a Debian-based system, such as Ubuntu, you can install sudo
by running the following command:
sudo apt-get install sudo
This will install the sudo
package and any necessary dependencies. Once the installation is complete, you should be able to use the sudo
command without encountering the "command not found" error.
If the sudo
package is already installed, but you are still seeing the "command not found" error, it may be because the sudo
command is not in the system's search path. To fix this, you can add the directory that contains the sudo
command to the PATH
environment variable.
For example, if the sudo
command is located in the /usr/bin
directory, you can add this directory to the PATH
variable by running the following command:
export PATH=$PATH:/usr/bin
This will add the /usr/bin
directory to the PATH
variable, which will allow the system to find the sudo
command when you run it.