linux下输入任何命令反馈的信息都是:
-bash: ls: command not found
-bash: su: command not found
-bash: dir: command not found
例如:-bash: XX命令: command not found
原因分析:环境变量错误,编辑 /etc/profile文件中出错。导致系统命令无法识别。
解决办法:在命令行下输入以下内容即可:
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
以上若无法彻底解决问题,请检查 /etc/profile中添加的环境变量命令是否正确,问题一定在这里,无需质疑。
修改 /etc/profile 文件后,立即使环境变量生效:
在命令下输入:source /etc/profile
本文解析了在Linux环境下输入命令时出现'command not found'错误的原因,通常由环境变量设置不当引起。提供了修改和检查环境变量的具体步骤,包括编辑/etc/profile文件及使更改立即生效的方法。

1812

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



