添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

The command could not be located because '/usr/bin' is not included in the PATH environment variable [duplicate]

Ask Question Can't execute terminal commands: "the command 'sudo' is available in '/usr/bin/sudo'" (5 answers)
Closed 9 years ago .

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

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.

This worked for me. /usr/bin/sudo /usr/bin/nano ~/.bashrc export PATH="/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/root/bin" – Mebatsion Sahle Apr 7, 2022 at 16:54