10

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

3 Answers 3

21

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.

2
  • Perfect, the only answer that is useful.
    – Smeterlink
    Jan 8, 2022 at 20:51
  • The files I have are not owned by any package because they arrived by some nefarious means. I'd like to find out who is supposed to own them, so I can properly pacman -S those packages. -Qo only reports "error: No package owns". I'm therefore looking at @mabalenk's answer.
    – NeilG
    Aug 13 at 23:14
2

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.

1
  • Perfect, the only answer that is useful.
    – Smeterlink
    Jan 8, 2022 at 20:51
2

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.

1
  • Trying this because I have files that exist but have not been installed by pacman. I'm getting: warning: database file for 'core' does not exist (use '-Fy' to download) and the same message for extra instead of core.
    – NeilG
    Aug 13 at 23:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .