Ubuntu – The command could not be located because ‘/usr/bin’ is not included in the PATH environment variable

sudo

Can someone tell me why I get this error when I try to add a repository and what if anything I can do about it?

When I try to add a repository using:

sudo add-apt-repository ppa:upubuntu-com/tor

I get the following error:

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

Best Answer

Your PATH variable has been messed up. Unless you are trying to run a restricted user with rbash, you should have /usr/bin in $PATH. For a terminal session you can fix this by running:

export PATH="/usr/bin:$PATH"

As @SylvainPineau mentioned, this answer covers how to permanently fix your path by editing the /etc/environment file.

Related Question