zoukankan      html  css  js  c++  java
  • [问题解决]bash: ifconfig: command not found

    遇到问题,参考网络解决。如下文,转载自http://happymen001.iteye.com/blog/674286

    ------

    法一:[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

    赠人玫瑰
    手留余香

    我们曾如此渴望命运的波澜,到最后才发现:人生最曼妙的风景,竟是内心的淡定与从容……我们曾如此期盼外界的认可,到最后才知道:世界是自己的,与他人毫无关系!-杨绛先生

    如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的推荐按钮。
    如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的关注我

  • 相关阅读:
    自定义事件类LoadEvent
    Sound
    (this.stage.getChildAt(0) as MovieClip).arr[1]
    menu菜单栏
    排列图片,自动换行
    滚动条
    滚动条使用示例
    载入类 举例
    舞台和主时间轴的关系
    自定义载入类(如图片、XML)
  • 原文地址:https://www.cnblogs.com/haochuang/p/2285185.html
Copyright © 2011-2022 走看看