Linux ifconfig 指令错误 安装
2019-03-11 本文已影响0人
054ab278d5d9
初装centos 7时,运行config报 command not found 错误,我在网上找了大量资料,下面的资料中查找原因和解决方式最详细,能很好的解决这个问题。
ifconfig命令是设置或显示网络接口的程序,可以显示出我们机器的网卡信息,可是有些时候最小化安装CentOS等Linux发行版的时候会默认不安装ifconfig等命令,这时候你进入终端,运行ifconfig命令就会出错

这是我们首先会想到是不是环境变量里没有ifconfig命令的路径,因为ifconfig是在/sbin路径下的,以root用户登录才可以运行,可是我们上边是以root用户登录的啊,不急,我们来看看root用户的环境变量

看到没,我们的环境变量里有/sbin这个路径,也居士说如果ifconfig命令存在并且就是位于/sbin目录下的话我们肯定就是可以运行的,那么我们就看看/sbin目录下有没有ifconfig命令吧

结果表明我们的/sbin目录下并没有ifconfig命令,所以我们的结论是:我们的CentOS里边是没有安装ifconf
———————————————分割线是一种态度———————————————
我们的解决办法是:yum安装ifconfig这个命令包

看到了吗,bash也是有分割线的,当然这不是在重点,重点是通过yum search 这个命令我们发现ifconfig这个命令是在net-tools.x86_64这个包里,接下来我们安装这个包就行了

这是我们已经安装好ifconfig这个命令了,我们试一下