`

bash: ifconfig: command not found 解决办法

阅读更多

方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出现使用了
方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin 这样设置后,下次就可以直接访问了,免处第一种的麻烦,但是只针对一个会话

方法三:root 用户编辑 /etc/profile 在文件最后追加 export PATH=$PATH:/sbin ,然后source /etc/profile

方法四:修改/etc/profile文件,注释掉if语句即可
把下面的if语句注释掉:
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
修改为
# Path manipulation
# if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
#fi

注:不光是ifconfig命令出现“bash: ifconfig: command not found”,原因非root用户的path中没有/sbin/ifconfig
,其它的命令也可以出现这种情况,解决的方法是一样的。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics