查找提供给定命令的包

Aug*_*rom 5 debian apt

如果command-not-found安装了软件包并且用户尝试运行系统上不存在的命令,则会打印一条建议,其中包含提供可执行文件的软件包的名称。是否有具有相同功能但以可执行文件的名称作为参数的命令?

编辑:我已阅读如何找出文件属于哪个(未安装)Debian 软件包?但没有一个建议提供一个命令,给出明确的结果,如command-not-found.

Ste*_*itt 11

你可以使用command-not-found它自己:

command-not-found --ignore-installed ls
Run Code Online (Sandbox Code Playgroud)

会告诉您哪个包包含该ls命令。(--ignore-installed避免考虑已安装的包,特别是确保如果命令已经安装,则不会立即运行。)

或者,您可以使用apt-file

apt-file search bin/ls
Run Code Online (Sandbox Code Playgroud)

将列出包含路径包含“bin/ls”的文件的所有包。您可以过滤它以仅匹配ls

apt-file search bin/ls | grep bin/ls$
Run Code Online (Sandbox Code Playgroud)