close

centos找不到IFCONFIG命令

[root@localhost dai]# ifconfig
bash: ipconfig: command not found
提示命令不存在

  使用 # /sbin/ifconfig 即可

  原因:系統默認的環境變數設置不對

  在普通用戶root用戶下分別執行echo $PATHPATH裏少了四個位址:/sbin:/usr/sbin:/usr/local/sbin:/usr/kerberos/sbinbash: ipconfig: command not found

  而,ifconfig恰恰就在/sbin裏面。

  或者

  下cat /etc/profile, 可以發現沒有關於/sbin的環境變數。

[dai@localhost ~]$ su
口令:

[root@localhost dai]# gedit /etc/profile

在檔末加入以下語句:

  PATH=$PATH:/sbin#在PATH變數後追加/sbin目錄

  export PATH=$PATH:/sbin#設置變數為全局的

  保存並退出。

  修改/home/用戶/.bash_profile,PATH後面添加/sbin:/usr/sbin:/usr/local/sbin:/usr/kerberos/sbin這幾個路徑。

  改完之後,執行命令:. .bash_profile,也可以註銷下或者重啟才能使剛剛修改的內容生效。

  再來sudo ifconfig , OK了。ifconfig shutdown 多能用了。

 

http://adam-dragon.blogspot.tw/2011/04/centosifconfig.html

 

arrow
arrow
    全站熱搜

    立你斯 發表在 痞客邦 留言(0) 人氣()