CentOS 7 運行 ifconfig 提示 -bash: ifconfig: command not found
VMWare安裝了CentOS7,選擇了最小安裝包模式,安裝完畢之後想查看一下本機的ip地址,發現報錯
#ifconfig -bash: ifconfig: command not found
谷歌了一下,整理了一下解決思路
查看ifconfig命令是否存在
查看 /sbin/ifconfig是否存在
2.如果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
轉載自:http://my.oschina.net/u/1428349/blog/288708