Linux修改/etc/profile配置异常command is not found自救方法

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

我的****博客地址: http://blog.****.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命令来修改啦!


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


版权声明:本文为博主原创文章,未经博主允许不得转载。