关于centos安装后一些命令找不到

刚才遇到那么尴尬的一个情况,输入啥命令都没找到。连ifconfig都不放过。

后分析极可能是以下两种缘故:

  1.缺少安装包

[root@Tzhost-170802-FCF0 /]# yum search ifconfig #搜索关于ifconfg的数据
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
============================================= Matched: ifconfig ==============================================
net-tools.x86_64 : Basic networking tools #net-tools.x86_64为搜索结果
[root@Tzhost-170802-FCF0 /]# yum install net-tools.x86_64 #安装

        2.缺少变量

缺少环境变量的情况
1.查看环境变量:echo $PATH
2.查看所有包含bin或者sbin的文件夹:find / -type d -name *bin
3.将2查看结果中没有包含在path中的目录添加到环境变量中:即修改/etc/profile文件,命令是gedit ect/profile 然后再这个文件的最后加上这样一句:export PATH=/usr/sbin:/bin:/usr/local/sbin:/usr/local/share/bin:$PATH,说明:每个目录以:隔开,这些都是之前未被包含进去的,要根据自己的情况来。
4.重启生效哦

原文地址:https://www.cnblogs.com/xishaonian/p/7446490.html