linux root用户执行命令提示command not fund

root用户执行大部分命令居然提示**-bash: ls: command not found**
在这里插入图片描述
使用有权限的用户名,登录系统,编辑/etc/profile文件,配置环境变量,增加/bin:/usr/bin:/sbin:/usr/sbin,重新加载/etc/profile文件即可。

1.[root@localhost /]# vim /etc/profile
2.加入:export PATH=/bin:/usr/bin:/sbin:/usr/sbin
3.保存、退出
4.[root@localhost /]# source /etc/profile
再次执行相关命令可行
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/yyyou_1/article/details/86615215