1. 程式人生 > >關於Red Hat Linux 9.0 企業版下輸入ifconfig顯示Command not found問題解決辦法

關於Red Hat Linux 9.0 企業版下輸入ifconfig顯示Command not found問題解決辦法

參考下面的部落格內容,做了適當的修改。

一、錯誤提示

$ifconfig

bash: ifconfig: command not found

$ip

bash: ip: command not found

二、問題原因

紅帽子作業系統的環境變數沒有配置好。

當我們輸入:$/sbin/ifconfig 的時候就可以顯示IP地址等資訊

三、解決辦法


1. 執行#cat ~/.bash_profile 看自己的PATH

2. 然後再執行:$su   切換到超級使用者root,隨後就輸入123456超級使用者的密碼
隨後符號由$變成#。

3. 編輯環境變數配置檔案 #gedit /etc/profile

然後會彈出一個文字框框,在最後一行後面新增:
export PATH=$PATH:/sbin
4. 儲存退出。
5. 最後讓配置生效:#source /etc/profile 這樣就全部搞定了

6. 然後在直接輸入:#ifconfig 就會直接顯示IP等資訊了

7. #su cg 切換回cg使用者後在試一試
$ifconfig 有效。