How to find a package that provides a given file in OpenSuSE

opensuserpmzypper

I am thinking on some like Contents-<arch>.gz on Debian. A network service were also okay. Does it exist?

Simple elaboration: For example, we need a binary named exampletool, which we know very good from other distributions or operation systems. We want to install that, for example, with zypper. But zypper can only install a package. To find out, in which package can we find the required exampletool binary, we need to do practically a search, and ideally a fast, indexed search in the file list of the currently not installed, but in the repositories available packages. On debian, there is an index file in the package repositories named Contents-amd64.gz, in which we can find the required package with a single zgrep command. I am looking for some similar, single-command solution for OpenSUSE, too. If there is none, a web service were also okay for the same functionality.

Best Answer

To search from all available packages to find a particular file, you can use the option wp or se --provides --match-exact as an example:

zypper se --provides --match-exact hg

You will see output similiar to the following:

Loading repository data...
Reading installed packages...

S | Name      | Summary                  | Type   
--+-----------+--------------------------+--------
  | mercurial | Scalable Distributed SCM | package

From that point you can install the package through a standard zypper install

zypper in mercurial

It should be noted that zypper wp is obsolete and may no longer be available.

Related Question