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

  有一次,在修改了/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命令来修改啦!

 

文章来源:https://blog.csdn.net/caicongyang/article/details/46789329

posted on 2018-06-27 23:38  bijian1013  阅读(870)  评论(0)    收藏  举报

导航