source /etc/profile报错-bash: id:command is not found

由于误操作导致

source /etc/profile 报错

-bash: id:command is not found 

此时,linux下很多命令到不能能用,包括vi ls 等...

可以使用

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

重新启用这些命令

如果 /etc/profile存在错误而导致source 不能成功,可以使用

/bin/vi  /etc/profile 编辑

原文地址:https://www.cnblogs.com/xiezhengcai/p/5825278.html