CentOS 7 ifconfig: command not found

Posted 程序员X

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7 ifconfig: command not found相关的知识,希望对你有一定的参考价值。

# ifcon
-bash: ifconfig: command not found
谷歌了一下,整理了一下解决思路

查看ifconfig命令是否存在

查看 /sbin/ifconfig是否存在


如果ifconfig命令存在,查看环境变量设置

#echo $PATH
如果环境变量中没有包含ifconfig命令的路径

临时修改环境变量:在shell中输入

$export PATH = $PATH:/sbin
然后再输入ifconfig命令即可,但是这只是临时更改了shell中的PATH,如果关闭shell,则修改消失,下次还需要重复如上操作

永久修改PATH变量使之包含/sbin路径:

打开/etc/profile文件,在其中输入export PATH=$PATH:/sbin,保存并重启即可,这样一来,PATH路径永久修改成功,以后任何时候只输入ifconfig命令即可

3. 如果ifconfig命令不存在

yum upgrade
yum install net-tools

以上是关于CentOS 7 ifconfig: command not found的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7 ifconfig: command not found

CentOS 7安装时候没装ifconfig命令

CentOS 7.0下解决ifconfig: command not found的方法

centos 7 安装 ifconfig 管理命令

Centos 7 安装 ifconfig 管理命令

解决CentOS 7 最小化安装后无ifconfig命令