Linux Ubuntu 相当于 Yum 的 WhatProvides,查找哪个包提供了文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4471327/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ubuntu equivalent of Yum's WhatProvides, to find which package provides a file
提问by Cerin
Fedora's yum
package management tool has a nice option called whatprovides
, which lets you find what package has installed a specific binary or file. What is the equivalent command on Ubuntu?
Fedora 的yum
包管理工具有一个很好的选项,叫做whatprovides
,它可以让你找到哪个包安装了特定的二进制文件或文件。Ubuntu 上的等效命令是什么?
For example, say I'd like to find what package provided /usr/bin/mysqladmin
. I know it should be something like mysql-server*
. I've read that apt-cache search blah
is a similar command, but running apt-cache search /usr/bin/mysqladmin
returns nothing. Is there a better command?
例如,假设我想查找提供的包/usr/bin/mysqladmin
。我知道它应该是这样的mysql-server*
。我读过这apt-cache search blah
是一个类似的命令,但运行apt-cache search /usr/bin/mysqladmin
什么都不返回。有没有更好的命令?
采纳答案by Glen Solsberry
I believe apt-filewill give you what you want.
我相信apt-file会给你你想要的。
$ apt-file update
$ apt-file list mysqladmin
kmysqladmin: /usr/bin/kmysqladmin
$ apt-file search mysqladmin
autoconf-archive: /usr/share/aclocal/ac_prog_mysqladmin.m4
autoconf-archive: /usr/share/autoconf-archive/html/ac_prog_mysqladmin.html
bash-completion: /etc/bash_completion.d/mysqladmin
kmysqladmin: /usr/bin/kmysqladmin
$ apt-file search mysqladmin
mysql-admin: /usr/share/mysql-gui/administrator/mysqladmin_health.xml
mysql-admin: /usr/share/mysql-gui/administrator/mysqladmin_startup_variables_description.dtd
mysql-admin: /usr/share/mysql-gui/administrator/mysqladmin_startup_variables_description.xml
mysql-admin: /usr/share/mysql-gui/administrator/mysqladmin_status_variables.xml
mysql-admin: /usr/share/mysql-gui/administrator/mysqladmin_system_variables.xml
mysql-client-5.1: /usr/bin/mysqladmin
mysql-client-5.1: /usr/share/man/man1/mysqladmin.1.gz
mysql-cluster-client-5.1: /usr/bin/mysqladmin
mysql-cluster-client-5.1: /usr/share/man/man1/mysqladmin.1.gz
mysql-testsuite: /usr/lib/mysql-testsuite/r/mysqladmin.result
mysql-testsuite: /usr/lib/mysql-testsuite/t/mysqladmin.test
回答by Shnatsel
I use dpkg -S filename
for that. It can't search for files that are not installed on your system with it, but it's shipped in all dpkg distros by default while apt-file is not.
我用dpkg -S filename
那个。它无法搜索系统上未安装的文件,但默认情况下所有 dpkg 发行版都附带它,而 apt-file 则没有。
You also can look that up for files that are not installed on your system using http://packages.ubuntu.com/website.
您还可以使用http://packages.ubuntu.com/网站查找系统上未安装的文件。