Skip to the content
pacman-master.com

Finding which package a file belongs to

Two axes answer nearly every file question about a package: whether you are asking about this machine or about the repositories, and whether you are starting from a path or from a package name. Four commands sit at the four corners.

pacman -Qo /usr/bin/ls
-Q
--query — ask the local database about packages that are already installed
-o
--owns — print which installed package owns the given file

Runs without root.

What it does. Name the installed package that owns a path on this machine.

Watch out. If no installed package owns it, the file arrived from somewhere other than pacman, and that is worth knowing before anything overwrites it.

The four corners

Four ways to ask about a file, and which one answers whichA square split into four. The left half is about packages installed on this machine, the right half about packages in the repositories. The top half starts from a path and asks for the package; the bottom half starts from a package and asks for its paths. The four cells hold pacman -Qo, pacman -F, pacman -Ql and pacman -Fl, each with the level the explainer gives it. A note underneath says -F reads a second set of databases and -Fy is what downloads them.installed on this machinein the repositoriesyou have a path, you want the packageyou have a package, you want its pathspacman -Qo /usr/bin/lsroutinewhich installed package owns itpacman -F lsroutinewhich repository package wouldpacman -Ql firefoxroutinewhat it put on diskpacman -Fl firefoxroutinewhat it would put there-F reads a second set of databases, and -Fy is what downloads them.
-Q asks the local record. -F asks the repository file databases, which have to be downloaded once first.
CommandQuestion it answersRoot?Level
pacman -Qo /usr/bin/lsWhich installed package owns this pathnoroutine
pacman -Ql firefoxWhat did this installed package put on disknoroutine
pacman -F lsWhich package in a repository carries a file with this namenoroutine
pacman -Fl firefoxWhat would this repository package put on disknoroutine
sudo pacman -FyDownload the file databases that -F readsyesroutine

The last row is the exception that catches people. Asking -F a question only reads, but the databases it reads are a second set that is not downloaded with an ordinary upgrade. Until -Fy has been run once, -F answers nothing.

Starting from a path you already have

-Qo takes a path and names the package. It works on paths that exist, and it is the command to reach for when pacman refuses an install because a file is in the way.

routinepacman -Qo /usr/bin/ls
/usr/bin/ls is owned by <package> <version>

The shape of the answer. When nothing owns the path, pacman says so, and that answer is the useful one: the file came from outside pacman.

That second case is exactly the one behind a conflicting files message. The error message page has the entry for it.

Starting from a package

-Ql lists what an installed package put on disk. It is long for anything with documentation, so it is usually paired with a filter:

routinepacman -Ql firefox
not pacmanpacman -Ql firefox | grep /usr/bin/

A pipe rather than a single pacman command, so no level is given: what grep does with the list is outside pacman.

The related question, whether the files a package owns are still the files on disk, has its own modifier:

routinepacman -Qk firefox

Checks the files this package owns against the local database. A doubled k checks them more thoroughly.

Asking about packages that are not installed

-F answers from the repository file databases, so it can tell you which package to install to get a command you do not have yet. That makes it the useful half of the pair when a command is missing rather than broken.

routinesudo pacman -Fy

Downloads the file databases into /var/lib/pacman, which is why this one writes and the rest of -F does not.

routinepacman -F ls

The file databases are refreshed by -Fy rather than by an ordinary upgrade, so on a machine that has not run it they are either missing or old. Running it again is cheap.

Common questions

How do I find which package owns a file on Arch Linux?

Run pacman -Qo followed by the path. It answers from the local database, so it covers packages installed on this machine. If nothing owns the path, the file came from somewhere other than pacman.

How do I list the files a package installed?

Run pacman -Ql followed by the package name. For a package that is not installed, pacman -Fl answers the same question from the repository file databases instead.

Why does pacman -F return nothing?

The file databases it reads are a separate set that an ordinary upgrade does not fetch. Running sudo pacman -Fy downloads them, after which -F has something to answer from.

What is the difference between pacman -Qo and pacman -F?

-Qo asks the local database about a path that exists on this machine. -F asks the repository file databases which package would carry a file with that name, whether or not it is installed.

How to check this page

Two commands on your own machine: pacman -<operation> --help lists the modifiers that operation accepts, and man pacman opens the pacman(8) manual page these descriptions are written from. Where the descriptions come from, and what this site is not, is set out on the about page.

This page was last edited on .