1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > bash: ifconfig: command not found

bash: ifconfig: command not found

时间:2022-06-26 11:35:31

相关推荐

bash: ifconfig: command not found

法一:[root@localhost sbin]$ /sbin/ifconfig就可以出现使用了

方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin ,这样设置后,下次就可以直接访问了,免处第一种的麻烦,如:

[root@localhost /]$ifconfig

--------------

[oracle@localhost /]$ ifconfig

提示:“bash: ifconfig: command not found”

于是我切换到root用户下

[root@localhost /]$ ifconfig

依然提示:“bash: ifconfig: command not found”

分析问题

1.whereis ifconfig 看一下这个命令在哪个目录下

2.echo $PATH 看一下该目录是否在路经下,注意lunux下是完全区分大小写的,所以不要忽略这点

3.执行命令,需要指定路径或者把目录加入PATH中

4.于是可以这样访问

方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出现使用了

方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin ,这样设置后,下次就可以直接访问了,免处第一种的麻烦,如:

[root@localhost /]$ ifconfig

方法三:修改/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

,其它的命令也可以出现这种情况,解决的方法是一样的。

重启网卡的几种方法:

一、network

利用root帐户

# service network restart

二、ifdown/ifup

# ifdown eth0

# ifup eth0

三、ifconfig

# ifconfig eth0 down

# ifconfig eth0 up

本文转自 念槐聚 博客园博客,原文链接:/haochuang/archive//12/12/2285185.html,如需转载请自行联系原作者

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。