LinuxCommandLibrary

pacman-files

Search which package owns a file

TLDR

Update the package database

$ sudo pacman -Fy
copy

Find the package that owns a specific [F]ile
$ pacman -F [filename]
copy

Find the package that owns a specific [F]ile, using a rege[x]
$ pacman -Fx '[regex]'
copy

List only the package names
$ pacman -Fq [filename]
copy

[l]ist the [F]iles owned by a specific package
$ pacman -Fl [package]
copy

Display [h]elp
$ pacman -Fh
copy

SYNOPSIS

pacman-files [options] [target...]

Example usages:
pacman-files -o /usr/bin/pacman
pacman-files -l bash
pacman-files -s '.*vim.*'
pacman-files -S

PARAMETERS

-h, --help
    Displays a help message and exits.

-l, --list
    Lists files owned by specified packages. Targets must be package names.

-o, --owner
    Shows the owning package of specified files. Targets must be file paths.

-s, --search
    Searches for files whose paths match the specified pattern. Targets must be file patterns. Can be combined with -o.

-q, --quiet
    Suppresses output of the owning package when used with -s, --search mode.

-S, --sync
    Synchronizes the file database with the local Pacman database. Requires root privileges.

-F, --files
    Explicitly tells the command to use the files database. This is the default behavior and is mostly for completeness with pacman -F.

DESCRIPTION

pacman-files is a command-line utility designed to query the Pacman file database, which tracks the files installed by various packages. It provides functionality to identify which package owns a specific file, list all files belonging to a particular package, or search for files matching a given pattern. This tool is especially useful for system administrators and users of Arch Linux and its derivatives to manage installed software, resolve file ownership, and diagnose issues related to package installations. It can also synchronize its file database with the main Pacman database.

CAVEATS

The -S, --sync option typically requires root privileges (e.g., using sudo). If Pacman operations are performed without root, or if the file database becomes corrupted, a manual synchronization using -S might be necessary. The file database is maintained by pacman-files and separate from Pacman's main package database.

RETURN CODES

0: All targets processed successfully.
1: An unknown error occurred.
2: An invalid option was passed.
3: A target was not found.

ENVIRONMENT

Refer to pacman(8) for environment variables that might influence its behavior, though pacman-files typically operates independently of most general Pacman environment settings.

HISTORY

pacman-files is part of the pacman-contrib package, which provides a collection of supplementary scripts and utilities for the Pacman package manager. Pacman itself was initially written by Judd Vinet and first released in 2002. pacman-files was developed later as a dedicated utility to interact specifically with Pacman's file database, offering a more direct and efficient way to query file ownership and paths than relying solely on the broader pacman command's capabilities for file queries (pacman -F). Its continued development aims to enhance the maintainability and diagnostic capabilities for Arch Linux systems.

SEE ALSO

pacman(8), pacman-query(1), find(1)

Copied to clipboard