Linux改动/etc/profile配置错误command is not found自救方法

我的CSDN博客地址: http://blog.csdn.net/caicongyang 

博主之前在改动了/etc/profile配置文件方法后,导致bash命令无法用

运行ls命令结果例如以下:

 -bash: ls:command is not found

可是庆幸的是博主之前备份了/etc/profile,于是我把profile通过SSH还原回去,可是如今须要运行  

# source /etc/profile

让配置文件又一次生效。然后不幸的事情是

 -bash: id:command is not found

发现 source命令已经不认识!

经过度娘提点,我们能够用命令又一次这是PATH;

# export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin  

运行完以上的命令后。你能够又一次运行 source /etc/profile命令来让你的配置文件生效


假设不幸的是你的profile配置文件没有备份。在直接使用vi命令无法使用的情况下,你能够在vi前面加上命令的地址

#/bin/vi  /etc/profile

这样就能够使用vi命令来改动啦。


我的CSDN博客地址: http://blog.csdn.net/caicongyang 


原文地址:https://www.cnblogs.com/yjbjingcha/p/6909727.html