-bash: sudo: command not found Error and Solution
The error message -bash: sudo: command not found means that the sudo command is not installed or not in your shell’s PATH. sudo is a command that allows users to run commands with elevated privileges (as the superuser).
Here are some steps to resolve the error:
- Check if
sudois installed:
$ which sudoIf the output is sudo not found, then sudo is not installed on your system.
- Install
sudo:
$ su -
# yum install sudoor
$ su -
# apt-get install sudoThis will install the sudo package on your system.
- Add the
sudocommand to your shell’s PATH:
$ echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc
$ source ~/.bashrcThis will add the /usr/local/bin directory to your shell’s PATH, which is where the sudo command is located on most systems.
- Verify that the
sudocommand is working:
$ sudo echo 'Hello, world!'If the sudo command is working, the output should be Hello, world!.
If you continue to receive the error message after following these steps, you may need to consult the documentation for your specific Linux distribution for additional guidance.
n (topvillasrealty.com)