linux安装报错之:ifconfig command not found解决
生活随笔
收集整理的這篇文章主要介紹了
linux安装报错之:ifconfig command not found解决
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
問題描述:
用虛擬機VMware安裝linux系統(tǒng)(鏡像文件是從官網(wǎng)下載的CentOS-7.0-1406-x86_64-DVD.iso),
在安裝完成之后,輸入ifconfig命令報錯:ifconfig command not found
?
解決思路:
1 確定是否是沒有安裝ifconfig,如果沒有,添加上去
2 確定是否是沒有添加到環(huán)境變量上,如果沒有,添加上去
?
解決方法:
首先判斷一下是不是缺少了ifconfig,它是在/sbin目錄下的[root@localhost ~]# cd /sbin [root@localhost sbin]# ls查看一下是否有 ifconfig沒有 ifconfig 的話安裝 net-tools package[root@localhost sbin]# sudo yum install net-tools?
參考:https://blog.csdn.net/dandelion_drq/article/details/53503487
?
當然,如果指定目錄下已經(jīng)存在ifconfig,也有可能是其它問題導致,比如環(huán)境變量沒有添加:
原本使用ifconfig 可以使用,今天是怎么了,可能安裝軟件修改了,百度~~[oracle@localhost /]$ ifconfig 提示:“bash: ifconfig: command not found” 于是我切換到root用戶下 [root@localhost /]$ ifconfig 依然提示:“bash: ifconfig: command not found” 分析問題 1.whereis ifconfig 看一下這個命令在哪個目錄下 2.echo $PATH 看一下該目錄是否在路經(jīng)下,注意lunux下是完全區(qū)分大小寫的,所以不要忽略這點 3.執(zhí)行命令,需要指定路徑或者把目錄加入PATH中 4.于是可以這樣訪問 方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出現(xiàn)使用了 方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin ,這樣設置后,下次就可以直接訪問了,免處第一種的麻煩,如: [root@localhost /]$ ifconfig 方法三:修改/etc/profile文件,注釋掉if語句即可 把下面的if語句注釋掉: # Path manipulation if [ "$EUID" = "0" ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin fi 修改為 # Path manipulation # if [ "$EUID" = "0" ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin #fi 注:不光是ifconfig命令出現(xiàn)“bash: ifconfig: command not found”,原因非root用戶的path中沒有/sbin/ifconfig,其它的命令也可以出現(xiàn)這種情況,解決的方法是一樣的。 ---------------------本文來自 xu1314 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/xu1314/article/details/6951762?utm_source=copy?
轉(zhuǎn)載于:https://www.cnblogs.com/whoknows1/p/9753097.html
總結(jié)
以上是生活随笔為你收集整理的linux安装报错之:ifconfig command not found解决的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Docker系列(一):容器监控工具We
- 下一篇: Linux shell去除字符串中所有空