我在执行 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
变量中。然后保存文件。希望这能奏效。祝你好运。