问题描述:

用虚拟机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解决的更多相关文章

  1. linux 安装报错:pkg-config not found

    linux 安装报错:pkg-config not found 使用编译安装时,在执行./configure时报如下错误: ... ... checking for pkg-config... no ...

  2. python安装locustio报错error: invalid command 'bdist_wheel'的解决方法

    locust--scalable user load testing tool writen in Python(是用python写的.规模化.可扩展的测试性能的工具) 安装locustio需要的环境 ...

  3. php编译安装 报错 make ***[libphp5.la] Error 1解决方法

    报错信息: /usr/bin/ld: cannot find -lltdl collect2: ld returned 1 exit status make: *** [libphp5.la] Err ...

  4. U盘安装Linux安装报错及解决方案

    导读 从网上看到了<Linux就该这么学>后,偏离软件行业多年的我下定决心回归!这篇文章是我这一个小白的亲身经历,希望能被采纳! 开始按照<Linux就该这么学>中所讲在自己的 ...

  5. linux下报错bash: service: command not found

    在linux下操作的时候经常会遇到,bash: service: command not found这个错误,以前在网上找了,照着弄了,也没细看原因,今天又碰到这个问题,就顺便研究一下. 1.通常这种 ...

  6. eclipse在linux安装报错

    JVM terminated. Exit code=127/usr/bin/java-Dosgi.requiredJavaVersion=1.8-Dosgi.instance.area.default ...

  7. python模块安装报错 :error: command 'gcc' failed with exit status 1

    参考:http://blog.csdn.net/fenglifeng1987/article/details/38057193 解决方法 yum install gcc libffi-devel py ...

  8. rlwrap安装报错You need the GNU readline 解决方法

    首先大家肯定知道rlwrap是干什么的? 在linux以及unix中,sqlplus的上下左右.回退无法使用,会出现乱码情况.而rlwrap这个软件就是用来解决这个的.   这个错误曾经困扰我很久很久 ...

  9. python中使用pip安装报错:Fatal error in launcher... 解决方法

    python安装了2和3版本在 cmd 中用pip报的错误为:Fatal error in launcher:Unable to create process using 这是因为你安装了python ...

随机推荐

  1. OpenGL位图函数

    [OpenGL位图函数] 1.OpenGL中glBitmap用于绘制一个二值阵列. When drawn, the bitmap is positioned relative to the curre ...

  2. C# Equals

    [C# Equals] 1.Object.Equals() The type of comparison between the current instance and the obj parame ...

  3. [Unity Shader笔记]渲染路径--Forward渲染路径

    [Unity Shader笔记]渲染路径--Forward渲染路径 (2014-04-22 20:08:25) 转载▼ 标签: shader unity renderingpath forward 游 ...

  4. C++——代码运行过程详解

    #include <iostream> using namespace std; ;//初始化的全局变量:保存在数据段 char *p1;//未初始化的全局变量:保存在BSS段 int m ...

  5. Reveal CocoaPods的使用

    Reveal是配合开发者编辑各种用户界面参数一款工具,运行界面如下,模拟器和真机都支持. Reveal使用时中不需要添加其他代码,只需要ios工程加载Reveal.framework,如果是真机需要确 ...

  6. Java-精确计算工具类

    import java.math.BigDecimal; import java.math.RoundingMode; /** * 精确计算工具类(加,减,乘,除,返回较大值,返回较小值) */ pu ...

  7. 使用 XML-RPC 为 C++ 应用程序启用 Web 服务

    http://www.ibm.com/developerworks/cn/webservices/ws-xml-rpc/ 引言 Internet 现在的受欢迎程度越来越高,由于这个原因及其固有的优势, ...

  8. 面向对象JS基础

    什么是面向对象?面向对象是一种思想!(废话). 面向对象可以把程序中的关键模块都视为对象,而模块拥有属性及方法.这样我们如果把一些属性及方法封装起来,日后使用将非常方便,也可以避免繁琐重复的工作.接下 ...

  9. Python监控日志程序-乾颐堂

    一个简易的日志监控的脚本,功能如下:1.windows环境2.当匹配日志关键字时会发出声音,匹配的关键字不同,播放的声音不同3.能做到实时响应 注意:是在win环境下哦 直接上代码吧 1 2 3 4 ...

  10. 设置ctp文件按html文件解析