[Seek Help] 【已解决】如何实现ubutnu 的 当命令不存在时,提示对应的安装包。
Tofloor
poster avatar
xcwenn
deepin
2022-04-12 19:01
Author

如何实现ubutnu 的 当命令不存在时,提示对应的安装包。

例子:

==============

根据大家提供的信息,操作如下

  1. 安装 对应的包

sudo apt-get install command-not-found

sudo apt-get update

  1. 重新打开终端。
Reply Favorite View the author
All Replies
Feng Yu
deepin
2022-04-12 19:16
#1

安装command-not-found这个包就行了

Reply View the author
云的眼泪
deepin
2022-04-12 19:27
#2

可能环境变量出问题了?

修改/etc/profile文件,在最后一行添加export PATH=$PATH:/sbin,source /etc/profile使刚刚的更改生效

我在基于ubuntu的银河麒麟系统输入ifconfig正常。

Reply View the author
xcwenn
deepin
2022-04-12 19:40
#3
Feng Yu

安装command-not-found这个包就行了

漂亮!!

Reply View the author
xcwenn
deepin
2022-04-12 20:30
#4
Feng Yu

安装command-not-found这个包就行了

command-not-found 安装了,目前看还是报错。 不知道有没有修复方案:>

image.png

程序扫描 /var/lib/apt/lists/*Contents* 但是 lists 下没有 这些文件

image.png

image.png

Reply View the author
Jack
deepin
2022-04-12 21:58
#5
xcwenn

command-not-found 安装了,目前看还是报错。 不知道有没有修复方案:>

image.png

程序扫描 /var/lib/apt/lists/*Contents* 但是 lists 下没有 这些文件

image.png

image.png

? 难道不是 输入 sudo apt install net-tools ?

Reply View the author
xcwenn
deepin
2022-04-12 22:02
#6
Jack

? 难道不是 输入 sudo apt install net-tools ?

我是要实现 当命令不存在时,提示对应的安装包。

截图只是个例子

Reply View the author
Jack
deepin
2022-04-12 22:09
#7
xcwenn

我是要实现 当命令不存在时,提示对应的安装包。

截图只是个例子

额,通常来说,bash会返回一个提示,如果没有的话,直接在论坛提出来吧。

Reply View the author
xcwenn
deepin
2022-04-12 22:21
#8

OK 了

安装好 command-not-found 后, 要运行 sudo apt-get update

重新打开终端 就好

image.png

Reply View the author
xcwenn
deepin
2022-04-12 22:21
#9
It has been deleted!
神末shenmo
deepin
Spark-App
Q&A Team
2022-04-12 22:45
#10
Feng Yu

安装command-not-found这个包就行了

好久不见了啊


Reply View the author