![关于无法找到命令,因为'/bin'未包含在PATH环境变量中](https://linux22.com/image/1067310/%E5%85%B3%E4%BA%8E%E6%97%A0%E6%B3%95%E6%89%BE%E5%88%B0%E5%91%BD%E4%BB%A4%EF%BC%8C%E5%9B%A0%E4%B8%BA'%2Fbin'%E6%9C%AA%E5%8C%85%E5%90%AB%E5%9C%A8PATH%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E4%B8%AD.png)
我在执行 Linux 命令时遇到问题:
root@PGStaging:/etc# 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
root@PGStaging:~# ps
Command 'ps' is available in '/bin/ps'
The command could not be located because '/bin' is not included in the PATH environment variable.
ps: command not found
如何解决上述问题?
答案1
我以前从未遇到过这个问题,所以我真的不知道这是否会起作用。试试这个:转到您的主目录,在那里您可以找到一个名为的文件.bashrc
(它是一个隐藏文件,因此为方便起见,请在文件资源管理器中启用“显示隐藏文件”)。使用文本编辑器打开该文件。然后,在文件末尾添加以下内容:
export PATH=$PATH:/bin
理论上,这会添加/bin
到您的PATH
变量中。然后保存文件。希望这能奏效。祝你好运。