命令在…中可用;无法找到该命令

命令在…中可用;无法找到该命令

我的终端有问题。我刚刚下载了一个 Android 模拟器,我的终端也出现了这种情况。我一直在使用 Ubuntu 12.04。

Command 'lesspipe' is available in the following places
 * /bin/lesspipe
 * /usr/bin/lesspipe
The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.
lesspipe: command not found
Command 'dircolors' is available in '/usr/bin/dircolors'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
dircolors: command not found
Command 'uname' is available in '/bin/uname'
The command could not be located because '/bin' is not included in the PATH environment variable.
uname: command not found
bash: [: =: unary operator expected
Command 'sed' is available in '/bin/sed'
The command could not be located because '/bin' is not included in the PATH environment variable.
sed: command not found
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found

答案1

运行以下命令:

export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:/home/sweet/android-sdk-linux/platfrom-tools

现在尝试执行命令。

如果您想要永久保存它,这样您就不需要一遍又一遍地输入它,请~/.bashrc使用geditby打开/usr/bin/gedit ~/.bashrc并找到行{PATH}:/home/sweet/android-sdk-linux/platfrom-tools。然后删除该行或#在其前面添加一个以将其注释掉。然后添加以下行:

export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:/home/sweet/android-sdk-linux/platfrom-tools

现在保存文件并从终端运行,source ~/.bashrc以便从当前终端会话正确设置路径。

答案2

只需运行以下命令: ctrl++alt使用f2 用户名和密码登录您的帐户。

sudo mv /etc/environment /etc/environment.bak
sudo touch /etc/environment
sudo reboot

相关内容