编辑 .bashrc 命令后返回“无法找到命令,因为 PATH 中不包含“/bin””

ogs*_*ogs 6 command-line bashrc

我输入的.bashrc东西,我不能使用像命令cpgeditls,等等等等了。终端给我一条消息,如:

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
Run Code Online (Sandbox Code Playgroud)

我试图恢复 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
Run Code Online (Sandbox Code Playgroud)

我能做什么?谢谢你。

mdp*_*dpc 30

看起来你的PATH变量搞砸了。

如果这种情况发生在您身上,并且您正在运行一个/bin/sh(或诸如 /bin/bash 之类的变体)......在命令行上输入以下内容:

 export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
Run Code Online (Sandbox Code Playgroud)

然后,您将能够轻松使用基本的 UNIX 命令,而无需在修复问题时使用 /....blah..../command 作为前缀。