Ubuntu相当于Yum的WhatProvides,用于查找哪个包提供了一个文件

时间:2022-05-04 21:24:11

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什么都不返回。有更好的指挥吗?

2 个解决方案

#1


22  

I believe apt-file will 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

#2


8  

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/ website查找系统上未安装的文件。

#1


22  

I believe apt-file will 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

#2


8  

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/ website查找系统上未安装的文件。