What is the pacman option to search for a package that owns a file? Like dpkg -S
in Debian-based distros.
3 Answers
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.
-
-
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.– NeilGAug 13 at 23:14
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.
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.
-
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 forextra
instead ofcore
.– NeilGAug 13 at 23:17