linux安装报错之:ifconfig command not found解决
问题描述:
用虚拟机VMware安装linux系统(镜像文件是从官网下载的CentOS-7.0-1406-x86_64-DVD.iso),
在安装完成之后,输入ifconfig命令报错:ifconfig command not found
解决思路:
1 确定是否是没有安装ifconfig,如果没有,添加上去
2 确定是否是没有添加到环境变量上,如果没有,添加上去
解决方法:
首先判断一下是不是缺少了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
当然,如果指定目录下已经存在ifconfig,也有可能是其它问题导致,比如环境变量没有添加:
原本使用ifconfig 可以使用,今天是怎么了,可能安装软件修改了,百度~~ [oracle@localhost /]$ ifconfig
提示:“bash: ifconfig: command not found”
于是我切换到root用户下
[root@localhost /]$ ifconfig
依然提示:“bash: ifconfig: command not found”
分析问题
.whereis ifconfig 看一下这个命令在哪个目录下
.echo $PATH 看一下该目录是否在路经下,注意lunux下是完全区分大小写的,所以不要忽略这点
.执行命令,需要指定路径或者把目录加入PATH中
.于是可以这样访问
方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出现使用了
方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin ,这样设置后,下次就可以直接访问了,免处第一种的麻烦,如:
[root@localhost /]$ ifconfig
方法三:修改/etc/profile文件,注释掉if语句即可
把下面的if语句注释掉:
# Path manipulation
if [ "$EUID" = "" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
修改为
# Path manipulation
# if [ "$EUID" = "" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
#fi
注:不光是ifconfig命令出现“bash: ifconfig: command not found”,原因非root用户的path中没有/sbin/ifconfig ,其它的命令也可以出现这种情况,解决的方法是一样的。
--------------------- 本文来自 xu1314 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/xu1314/article/details/6951762?utm_source=copy
linux安装报错之:ifconfig command not found解决的更多相关文章
- linux 安装报错:pkg-config not found
linux 安装报错:pkg-config not found 使用编译安装时,在执行./configure时报如下错误: ... ... checking for pkg-config... no ...
- python安装locustio报错error: invalid command 'bdist_wheel'的解决方法
locust--scalable user load testing tool writen in Python(是用python写的.规模化.可扩展的测试性能的工具) 安装locustio需要的环境 ...
- php编译安装 报错 make ***[libphp5.la] Error 1解决方法
报错信息: /usr/bin/ld: cannot find -lltdl collect2: ld returned 1 exit status make: *** [libphp5.la] Err ...
- U盘安装Linux安装报错及解决方案
导读 从网上看到了<Linux就该这么学>后,偏离软件行业多年的我下定决心回归!这篇文章是我这一个小白的亲身经历,希望能被采纳! 开始按照<Linux就该这么学>中所讲在自己的 ...
- linux下报错bash: service: command not found
在linux下操作的时候经常会遇到,bash: service: command not found这个错误,以前在网上找了,照着弄了,也没细看原因,今天又碰到这个问题,就顺便研究一下. 1.通常这种 ...
- eclipse在linux安装报错
JVM terminated. Exit code=127/usr/bin/java-Dosgi.requiredJavaVersion=1.8-Dosgi.instance.area.default ...
- python模块安装报错 :error: command 'gcc' failed with exit status 1
参考:http://blog.csdn.net/fenglifeng1987/article/details/38057193 解决方法 yum install gcc libffi-devel py ...
- rlwrap安装报错You need the GNU readline 解决方法
首先大家肯定知道rlwrap是干什么的? 在linux以及unix中,sqlplus的上下左右.回退无法使用,会出现乱码情况.而rlwrap这个软件就是用来解决这个的. 这个错误曾经困扰我很久很久 ...
- python中使用pip安装报错:Fatal error in launcher... 解决方法
python安装了2和3版本在 cmd 中用pip报的错误为:Fatal error in launcher:Unable to create process using 这是因为你安装了python ...
随机推荐
- JsSIP 注册,拨打填坑
吐个槽: http://tryit.jssip.net/ 这个毛东西,默认是要使用视频的,而且没得设置不使用,至少我没看到有设置的!!!(其实就是写死了,翻了他的js代码的-_-||) 设置连接到自 ...
- 字符串匹配——C++使用Regex
需要#include < regex > 匹配 regex_match ("subject", std::regex("(sub)(.*)") ...
- IDEA05 mybatis插件之MyBatisCodeHelper-Pro
前提准备: >IDEA专业版本 1 安装MyBatisCodeHelper-Pro IDEA提供了插件安装功能,可以根据开发需要安装适合的插件 >help -> find actio ...
- HBase、HDFS与本地文件系统之间的关系
一.文件系统 1. 概念 所谓文件系统,是操作系统用于明确磁盘或分区上的文件的方法和数据结构:即在磁盘上组织文件的方法.也指用于存储文件的磁盘或分区,或文件系统种类. 2. Local File Sy ...
- 服务器监控方案CactiEZ V10.1
CactiEZ中文版是最简单有效的Cacti中文解决方案,整合Spine,RRDTool和美化字体.集成Thold,Monitor,Syslog,Weathermap,Realtime,Errorim ...
- nyoj746 整数划分
nyoj746 http://acm.nyist.net/JudgeOnline/problem.php?pid=746 一道区间dp的题目: 设:a[i][j]为那一串数字中从第i位到第j位的数是多 ...
- ubuntu如何安装samba
1.samba安装sudo apt-get install samba2.修改smb.confsudo gedit /etc/samba/smb.conf 文件最后增加如下代码:[share] pat ...
- 44个javascript 变态题解析
原题来自: javascript-puzzlers 读者可以先去做一下感受感受. 当初笔者的成绩是 21/44… 当初笔者做这套题的时候不仅怀疑智商, 连人生都开始怀疑了…. 不过, 对于基础知识的理 ...
- linux的操作
对tomcat的操作 打开终端 cd /java/tomcat#执行bin/startup.sh #启动tomcatbin/shutdown.sh #停止tomcat tail -f logs/cat ...
- Spring 注解 整理
首先 在xml中配置 xmlns:context="http://www.springframework.org/schema/context" http://www.spring ...