天天看點

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

轉載于:https://www.cnblogs.com/lovezhaolei/p/5592241.html