我在 Bashrc 中输入了一些内容,但我无法再使用诸如cp
、gedit
、ls
等命令。终端向我发送了如下消息:
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
我试图恢复 bashrc,但我需要使用cp
并且我也不能使用这个命令:
Command 'cp' is available in '/bin/cp'
The command could not be located because '/bin' is not included in the PATH environment variable.
cp: command not found
我能做什么?谢谢。
答案1
看起来你的PATH
变量弄乱了。
如果您遇到这种情况,并且您正在运行/bin/sh
(或变体如 /bin/bash)....在命令行中输入以下内容:
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
然后,您将能够轻松使用基本 UNIX 命令,而无需在解决问题时在其前面加上 /....blah..../command。