今天修改/etc/profile下的环境变量,执行过source /etc/profile之后:
[root@localhost ]# vim /etc/profile
bash: vim: command not found
找不到命令了
解决方法:
[root@localhost ]# export PATH=/usr/bin:/usr/sbin:/bin:/sbin
[root@localhost ]# vim /etc/profile
[root@localhost ]# source /etc/profile
操作需谨慎啊!!!
在尝试修改Linux系统的/etc/profile文件以更新环境变量后,遇到命令找不到的问题。错误表现为执行vim命令时返回'command not found'。解决方案是临时设置PATH环境变量,包括/usr/bin、/usr/sbin、/bin和/sbin路径,然后重新打开vim编辑profile,并source使更改生效。提醒注意此类系统级操作需谨慎进行。

被折叠的 条评论
为什么被折叠?



