如何在 Ubuntu 上找到包含给定程序的包?

eju*_*ker 13 package-management ubuntu aptitude apt

我经常知道我需要的命令行程序的名称,但我不知道提供该程序的包的名称。如何找到包含我需要的程序的包的名称?在基于 RPM 的系统上,他们可以whatprovides选择rpm -q --whatprovides /usr/X11R6/bin/xclock找到正确的软件包。基于 Debian 的系统有类似的东西吗?

wom*_*ble 22

如果安装了该软件包,您需要dpkg -S /path/to/file. 如果未安装该软件包,则使用 apt-file 实用程序 ( apt-file update; apt-file search /path/to/file)。


Mar*_*ark 11

Ubuntu 有一个 command-not-found 实用程序,它会告诉你安装哪个包来获取特定命令。如果配置正确(也许在默认安装中?),当您输入未安装的命令时,它将显示出来。但是,您也可以手动运行它:

$ /usr/lib/command-not-found --ignore-installed test
The program 'test' is currently not installed.  You can install it by typing:
sudo apt-get install coreutils
Run Code Online (Sandbox Code Playgroud)