问题描述:

用虚拟机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. 面试------Android 版本之前的差异(常见,欢迎补充)。

    不管你技术如何,只要背点这个,能忽悠倒一片.. 1.WebView JS漏洞 ,Android4.2之前 ,解决办法,不用addJavascriptInterface,webchrome的onJsPr ...

  2. java算法 第七届 蓝桥杯B组(题+答案) 10.压缩变换

    10.压缩变换  (程序设计) 小明最近在研究压缩算法.他知道,压缩的时候如果能够使得数值很小,就能通过熵编码得到较高的压缩比.然而,要使数值很小是一个挑战. 最近,小明需要压缩一些正整数的序列,这些 ...

  3. built-in SpecularType of Unity

    [built-in SpecularType of Unity] 1.声明变量. 注意并没有在Shader中声明_SpecColor,因为Lighting.cginc中已经帮我们声明. 2.声明使用B ...

  4. iOS导航栏自由缩放头像效果

    效果图: 上代码: 先给一个self.navigationItem.titleView ,然后再放个ImangeView添加到titleView上: UIView *titleView = [[UIV ...

  5. 《Android Studio实用指南》7.1 AndroidStudio代码检查工具概述

    本文节选自<Android Studio实用指南> 作者: 毕小朋 目前本书已上传到百度阅读, 在百度中搜索[Anroid Studio实用指南]便可以找到本书. Android Stud ...

  6. springboot用于web开发

    1.使用SpringBoot:1)创建SpringBoot应用,选中我们需要的模块:2)SpringBoot已经默认将这些场景配置好了,只需要在配置文件中指定少量配置就可以运行起来3)自己编写业务代码 ...

  7. eclipse导入web项目报错 Cannot find the class file for javax.servlet.ServletContext.

    当eclipse中新导入的Java Project的时候,往往会碰到各种各样的问题,下面是个典型的问题: Cannot find the class file for javax.servlet.Se ...

  8. static_cast, dynamic_cast, reinterpret_cast, const_cast区别比较

    隐式转换(implicit conversion) ; int b; b=a; short是两字节,int是四字节,由short型转成int型是宽化转换(bit位数增多),编译器没有warning,如 ...

  9. oracle数据库学习记录(持续更新中...)

    --------------------------------------------day1------------------------------------------------- 1. ...

  10. Reading——简约至上

    读书感言: 简约至上——Giles Colborne,我去,这是哪里来的渣书,通篇都是泛泛而谈,实在受不鸟了> <,没学到啥实质性的东西,论述一大堆.!!!还姐的20多块钱.最讨厌这样的书 ...