问题描述:
添加hadoop环境变量后,后来发现由于格式错误,source /etc/profile后导致所有Linux命令失效。
[root@slave02 ~]# vim /etc/profile
-bash: vim: command not found
[root@slave02 ~]# ll
-bash: ls: command not found
[root@slave02 ~]# cat /etc/profile
-bash: cat: command not found
[root@slave02 ~]#
[root@slave02 ~]#
[root@slave02 ~]#
[root@slave02 ~]#
[root@slave02 ~]# /bin/vim /etc/profile
解决办法:
由于没有执行其它删除操作,不是bin库丢失导致命令失效。只要修改配置文件到初始状态即可。
可用 /bin/vim /etc/profile修改配置文件
然后source /etc/profile
如果修改后执行source报错,说明没有还有些环境配置没有注释或删除掉
[root@slave02 ~]# source /etc/profile
/usr/libexec/grepconf.sh: line 5: grep: command not found