In Arch Linux how can I find out which package to install that will contain file X?

I’m looking for a package that provides a specific binary, so I can install it. how can I search to find out what packages provide this binary? (note: I know there’s at least one tool that does this, but I have forgotten its name.)

Asked By: xenoterracide


Since pacman 5.0, there is built-in functionality for searching the database with the -F option. First update the database:

sudo pacman -Fy

Then you can see which package contains $filename with

pacman -F $filename

if you are searching for an exact file name or full path, or

pacman -Fx $expr

to have $expr interpreted as a regular expression.

Since you knew you were looking for an equivalent of apt-file, you could have looked it up in the Pacman Rosetta.

Alternatively, you can use pkgfile. Install it with pacman -S pkgfile, then run

sudo pkgfile -u

to update the database. To see what package contains $filename, run

pkgfile $filename

From ArchWiki:

$ pacman -Qo df

This will yield the owning package of the program df (at the time of writing, this is coreutils).

-Qo only operates on installed packages and their programs.

You can to see more arguments in querying package databases.

Answered By: amiad

the google way: bin/filename

and in case it is in AUR instead of an official package: bin/filename
Answered By: eshizhan