长话短说, "command not found" 找不到命令 这类错误出现的原因有很多,根据具体情况分析,常见的有以下3种 不是可执行命令,也就是你输入的代码不合法,没有被定义 [root@localhost test]# jsjsj
长话短说,
"command not found" 找不到命令
这类错误出现的原因有很多,根据具体情况分析,常见的有以下3种
不是可执行命令,也就是你输入的代码不合法,没有被定义
[root@localhost test]# jsjsjjdjdbash: jsjsjjdjd: command not found...[root@localhost test]# $? 像$?这种不可直接执行的命令会出现这类错误,修改我们的输出格式就好了bash: 0: command not found...#比如[root@localhost test]# echo $? #echo为可执行命令127
如果是echo、mv、vim等都出现command not found 报错的话,很大概率就是未配置环境变量
解决方法:
[root@localhost test] echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin[root@localhost test] vim ~/.bash_profile# .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/binexport PATH
如果命令别名被修改也会出现这类错误
[root@localhost test] lltotal 32-rw-r--r--. 1 root root 197 Aug 22 22:38 test1.sh-rw-r--r--. 1 root root 429 Aug 20 16:11 test2.sh-rw-r--r--. 1 root root 233 Aug 20 16:03 test3.sh[root@localhost test] unalias ll[root@localhost test] llbash: ll: command not found...[root@localhost test] alias #查看命令别名[root@localhost test] alias ll='ls -l --color=auto' #定义ll的命令别名
来源地址:https://blog.csdn.net/weixin_62107875/article/details/126457172
--结束END--
本文标题: 一分钟带你解决“command not found“报错
本文链接: https://www.lsjlt.com/news/389389.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-06-03
2024-06-03
2024-06-04
2024-06-03
2024-06-03
2024-06-03
2024-06-03
2024-06-04
2024-06-03
2024-06-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0