04ifconfig命令报错:command not found 解决方法

在Linux系统下,当要查询当前主讲的ip地址时,输入命令ifconfig,但是却出了 command not found 的提示
image

ifconfig命令失败,说明没有将ipconfig命令配置到环境变量,需要进行如下配置

  1. 使用管理员权限 运行以下命令
vi /etc/profile

# 在profile文件里面
PATH=$PATH:/sbin
export PATH=$PATH:/sbin

image

  1. 保存文件并退出

ctrl+c ,然后 :wq 保存文件

  1. 让配置文件生效
source /etc/profile
  1. 但是如果你安装的是CentOS最小安装包模式,还需要安装网络工具
yum install upgrade
yum install net-tools

安装完后,再次执行ifconfig,显示成功

posted @ 2024-03-15 17:49  songxia777  阅读(488)  评论(0编辑  收藏  举报