centos缺少ifconfig,bash: ifconfig: command not found

发布时间:2018-04-23作者:laosun阅读(3088)

centos缺少ifconfig,bash:

CentOS7:ifconfig command not found解决,因为我安装的是centos Minimal版本,无法使用ifconfig等指令,所以需要手动进行安装

    查看ifconfig命令是否存在

    如果ifconfig命令不存在

    [root@CentOS_7 /]# ll /sbin/ifconfig

    安装 net-tools package

    [root@localhost sbin]# yum install net-tools

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

    [root@CentOS_7 /]# echo $PATH
    /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/sun/.local/bin:/home/sun/bin

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

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

    [root@CentOS_7 /]# $export PATH = $PATH:/sbin

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

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

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


1 +1

版权声明

 linux

 请文明留言

1 条评论