pacman option to search for packages that own a file

What is the pacman option to search for a package that owns a file? Like dpkg -S in Debian-based distros.

Asked By: mja

||

It is pacman -Qo <filename>.

Example

% pacman -Qo x86_64-pc-linux-gnu-pkg-config
/usr/bin/x86_64-pc-linux-gnu-pkg-config is owned by pkgconf 1.6.3-1

From pacman(8):

Query Options (apply to -Q)

-o, –owns <file>

Search for packages that own the specified file(s). The path can be relative or absolute, and one or more files can be specified.

Answered By: mja

From Pacman/Rosetta (adapted from a table):

Query the package which provides FILE

  • Arch: pacman -Qo
  • Debian/Ubuntu: dpkg -S / dlocate

As shown above (and as its name implies), the page presents ways to perform
certain actions in pacman and their equivalents in other package managers, so
it might be worth checking out when coming from other distributions.

Answered By: kelvin

To search for a remote package (a package not installed on the system) use:

pacman -F <filename>

For example,

pacman -F omp-tools.h

This command will give you the remote package name.

Answered By: mabalenk