ifconfig是linux中用于顯示或配置網(wǎng)絡(luò)設(shè)備(網(wǎng)絡(luò)接口卡)的命令,英文全稱是network interfaces configuring了,這個命令一般情況下默認是安裝好的,如果沒安裝好在使用時會提示bash: ifconfig: command not found...了,下面我就碰到這種問題下面來看看.
如果出現(xiàn)下面問題:
- [root@thunderspeed ~]# ifconfig
- bash: ifconfig: command not found...
- [root@thunderspeed ~]#
- [root@thunderspeed ~]# netstat
- bash: netstat: command not found...
- [root@thunderspeed ~]#
分析問題:
1.whereis ifconfig 看一下這個命令在哪個目錄下.
2.echo $PATH 看一下該目錄是否在路經(jīng)下,注意lunux下是完全區(qū)分大小寫的,所以不要忽略這點.
3.執(zhí)行命令,需要指定路徑或者把目錄加入PATH中.
于是可以這樣訪問:
方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出現(xiàn)使用了.
方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin,這樣設(shè)置后,下次就可以直接訪問了,免處第一種的麻煩,如:
[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 --Vevb.com
如果還不行可能需要安裝一下使用provides搜索依賴包:sudo yum provides ifconfig
搜索結(jié)果是:net-tools 因此需要安裝 net-tools包即可
sudo yum install net-tools
保存,重新啟動.
新聞熱點
疑難解答
圖片精選