CentOS:命令没有链接/工作

最近安装的CentOS和许多命令都不起作用:

[root@zrebirth zeno]# quotacheck bash: quotacheck: command not found [root@zrebirth zeno]# adduser bash: adduser: command not found [root@zrebirth zeno]# warnquota bash: warnquota: command not found [root@zrebirth zeno]# edquota bash: edquota: command not found 

但是它们都存在,所以它们不能被链接:

 /sbin/quotacheck /usr/sbin/adduser /usr/sbin/warnquota /usr/sbin/edquota 

我相信还有更多。 有没有办法,我可以快速修复所有这些(即使是我不知道的),而不是手动做每一个?

看来你只需要修改你的$ PATH。 下面的文章会介绍如何做到这一点。

Cyber​​citi

在我默认的CentOS安装中,它只有/ bin作为我的path。 因此,如果我想input/ binpath之外的任何其他命令,则需要完全input命令(如“/ sbin / command”)或添加这些path。

 [blah~]$ cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH 

从Centos文档( http://wiki.centos.org/TipsAndTricks/BecomingRoot ):

常规用户的命令大多位于/ usr / local / bin,/ usr / bin和/ bin中。 但是,root命令大部分位于/ usr / local / sbin,/ usr / sbin和/ sbin中,而root的PATH反映了这一点。当你使用'su – '成为root的时候,你也采用root的PATH,而使用'su '保留原来的用户path,因此为什么只用'su'来试图运行位于/ usr / local / sbin,/ usr / sbin或/ sbin的命令会导致'command not found'错误。 有关更详细的解释,请参阅bash手册页(man bash),特别是有关INVOCATION和loginshell的部分。

你需要使用“su – ”而不是“su”。