问题描述:

用虚拟机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. 文件 md5 查看 命令

    Windows命令查看文件MD5   certutil -hashfile yourfilename.ext MD5 certutil -hashfile yourfilename.ext SHA1 ...

  2. Linux实战教学笔记28:企业级LNMP环境应用实践

    一,LNMP应用环境 1.1 LNMP介绍 大约在2010年以前,互联网公司最常用的经典Web服务环境组合就是LAMP(即Linux,Apache,MySQL,PHP),近几年随着Nginx Web服 ...

  3. C#匿名类型 - Anonymous Types

    [C#匿名类型 - Anonymous Types] Anonymous types provide a convenient way to encapsulate a set of read-onl ...

  4. Codeforces 1154G 枚举

    题意:给你一堆数,问其中lcm最小的一对数是什么? 思路:因为lcm(a, b) = a * b / gcd(a, b), 所以我们可以考虑暴力枚举gcd, 然后只找最小的a和b,去更新答案即可. 数 ...

  5. Openssl genrsa命令

    一.简介 生成RSA私有密钥 二.语法 openssl genrsa [-out filename] [-passout arg] [-f4] [-] [-rand file(s)] [-engine ...

  6. a Concise Sparse Matrix package

    简明稀疏矩阵包 https://github.com/kulhanek/csparse https://github.com/kulhanek/csparse

  7. XStream(xml/bean转换)

    XStream 1. 什么作用  * 可以把JavaBean转换为(序列化为)xml 2. XStream的jar包  * 核心JAR包:xstream-1.4.7.jar:  * 必须依赖包:xpp ...

  8. STL中 set 和 multiset

    1. 所在头文件: <set>, 命名空间: std ; 声明如下: namespace std{ template <class T, class Compare = less&l ...

  9. CSS 伪类和伪元素--pseudo

    总结在前: 0. 参考资料 1. 伪类和伪元素是不同的两种东西. 2. 伪类和伪元素都属于CSS选择器. 3. CSS引入伪类和伪元素是为了实现基于文档树之外的信息,i.e. 段落的第一行,的格式化. ...

  10. HDU 3366 Passage (概率DP)

    题意:T组测试数据,一个人困在了城堡中,有n个通道,m百万money ,每个通道能直接逃出去的概率为 P[i] ,遇到士兵的概率为 q[i], 遇到士兵得给1百万money,否则会被杀掉,还有 1-p ...