ifconfig: command not found

问题:在linux 5中查询IP地址时,输入ifconfig命令报错:“ifconfig: command not found”

原因:ifconfig命令所在路径/sbin未包含在系统环境变量PATH中

解决方法:

1. 直接输入:/sbin/ifconfig

2. 临时修改环境变量:在shell中输入

   $export PATH = $PATH:/sbin

   然后再输入ifconfig命令即可,但是这只是临时更改了shell中的PATH,如果关闭shell,则修改消失,下次还需要重复如上操作

3.永久修改PATH变量使之包含/sbin路径:

   打开/etc/profile文件,在其中输入export PATH=$PATH:/sbin,保存并重启

猜你喜欢

转载自sunwonder.iteye.com/blog/2197451