bash: ifconfig: command not found 解决办法
2015-10-19 09:11
537 查看
转自: http://gardenyuan.iteye.com/blog/1001970
原本使用ifconfig 可以使用,今天是怎么了,可能安装软件修改了,百度~~
[oracle@localhost /]$ ifconfig
提示:“bash: ifconfig: command not found”
于是我切换到root用户下
[root@localhost /]$ ifconfig
依然提示:“bash: ifconfig: command not found”
分析问题
1.whereis ifconfig 看一下这个命令在哪个目录下
2.echo $PATH 看一下该目录是否在路经下,注意lunux下是完全区分大小写的,所以不要忽略这点
3.执行命令,需要指定路径或者把目录加入PATH中
4.于是可以这样访问
方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出现使用了
方法二:[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
]# source /etc/profile
注:不光是ifconfig命令出现“bash: ifconfig: command not found”,原因非root用户的path中没有/sbin/ifconfig
,其它的命令也可以出现这种情况,解决的方法是一样的。
原本使用ifconfig 可以使用,今天是怎么了,可能安装软件修改了,百度~~
[oracle@localhost /]$ ifconfig
提示:“bash: ifconfig: command not found”
于是我切换到root用户下
[root@localhost /]$ ifconfig
依然提示:“bash: ifconfig: command not found”
分析问题
1.whereis ifconfig 看一下这个命令在哪个目录下
2.echo $PATH 看一下该目录是否在路经下,注意lunux下是完全区分大小写的,所以不要忽略这点
3.执行命令,需要指定路径或者把目录加入PATH中
4.于是可以这样访问
方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出现使用了
方法二:[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
]# source /etc/profile
注:不光是ifconfig命令出现“bash: ifconfig: command not found”,原因非root用户的path中没有/sbin/ifconfig
,其它的命令也可以出现这种情况,解决的方法是一样的。
相关文章推荐
- Linux下高效编写Shell——shell特殊字符汇总
- shell技巧
- HBase基本概念和hbase shell常用命令用法
- HBase shell命令小记
- git使用之二
- 一个利用sql注入上传shell的姿势
- Shell+Curl网站状态检查脚本 抓出无法访问的站点
- linux shell批量压缩某个目录下图片大小
- Bash字符串操作
- 05_02 bash编程
- 坏的数组下标
- 使用xshell连接vmware虚拟机安装的centos服务器
- BAT脚本如何自动执行 adb shell 以后的命令
- bash shell之数组使用
- Linux学习 -- Shell编程 -- 流程控制
- <草稿>.bash_profile/.bash_login/.profile的区别联系
- shell脚本
- Linux学习 -- Shell编程 -- 条件判断
- shell let expr $(()) 命令
- Linux学习 -- Shell编程 -- 字符处理命令