How to fix sudo: command not found

How to fix sudo: command not found

While using ‘sudo’ command or while opening an application which is already installed in your system you may get like sudo: command not found

Error:

How to fix sudo: command not found
 Command 'sudo' is available in the following places  * /bin/sudo  * /usr/bin/sudo The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable. sudo: command not found   

or while opening any apps

How to fix sudo: command not found
 Command 'nethogs' is available in the following places  * /sbin/nethogs  * /usr/sbin/nethogs The command could not be located because '/usr/sbin:/sbin' is not included in the PATH environment variable. This is most likely caused by the lack of administrative privileges associated with your user account. nethogs: command not found   

Reason:

This error is usually caused if the path is not not included in environment variable.

Solution to the problem:

Use command export PATH=”{path}:$PATH” in this case it is

 user@system: export PATH="/usr/bin:$PATH"  

and press enter.

2. Permanent solution(May cause conflicts with some files in future)

open file ~/.bashrc in terminal

 sudo nano ~/.bashrc  

and add paste the line export PATH=”/usr/bin:$PATH” at the end of the page

How to fix sudo: command not found

and press ctrl + x and then press y to save it.

Note: This method may not work instantly, if so then restart your system.

Related Posts

3 thoughts on “How to fix sudo: command not found

Leave a Reply

Your email address will not be published. Required fields are marked *