由chkconfig 引发的联想——怎么查看程序是否已经安装/成功安装

由chkconfig 引发的联想——怎么查看程序是否已经安装/成功安装

某天需要运行chkconfig,root登录依然找不到该命令。

[root@localhost ~]# chkconfig
bash: chkconfig: command not found

为什么,先看看chkconfig是不是安装过了?

[root@localhost ~]# rpm -q chkconfig
chkconfig-1.3.30.1-2

是安装过的,安装到哪里了?

[root@localhost ~]# whereis chkconfig
chkconfig: /sbin/chkconfig /usr/share/man/man8/chkconfig.8.gz

/sbin/chkconfig 在这里,那为什么不识别命令,看看环境变量

[root@localhost ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/zhaoxueqian/bin

没有找到/sbin这个目录,加进去再说,网上一搜一堆

[root@localhost ~]# export PATH=$PATH:/sbin/

再次尝试chkconfig

[root@localhost ~]# chkconfig
chkconfig version 1.3.30.1 - Copyright (C) 1997-2000 Red Hat, Inc.
...

原文地址:https://www.cnblogs.com/fanhaomin/p/3255095.html