LinuxCommandLibrary

pkgfile

Find package providing a specific file

TLDR

Synchronize the pkgfile database

$ sudo pkgfile --update
copy

Search for a package that owns a specific file
$ pkgfile [filename]
copy

List all files provided by a package
$ pkgfile --list [package]
copy

List executables provided by a package
$ pkgfile --list --binaries [package]
copy

Search for a package that owns a specific file using case-insensitive matching
$ pkgfile --ignorecase [filename]
copy

Search for a package that owns a specific file in the bin or sbin directory
$ pkgfile --binaries [filename]
copy

Search for a package that owns a specific file, displaying the package version
$ pkgfile --verbose [filename]
copy

Search for a package that owns a specific file in a specific repository
$ pkgfile --repo [repository_name] [filename]
copy

SYNOPSIS

pkgfile [options] [file_pattern ...]

PARAMETERS

-u, --update
    Update the file list database.

-r, --refresh
    Force refresh the cache.

-f, --file
    Search the file list for a file matching the specified pattern.

-d, --directory
    Search the file list for a directory matching the specified pattern.

-s, --source
    Search the file list for source files matching the specified pattern.

-b, --debug
    Enable debug output.

-v, --verbose
    Enable verbose output.

-h, --help
    Display help message.

-q, --quiet
    Suppress all output except errors.

--cache
    Specify an alternate cache directory.

--database
    Specify an alternate database file.

--no-color
    Disable colored output.

--include
    Include an external database.

DESCRIPTION

The `pkgfile` command is a utility used to determine which package(s) provide a specific file on Arch Linux and similar distributions. It searches a database of files and their corresponding packages, allowing users to quickly identify the source of a particular file. This is particularly useful for resolving dependencies, understanding where a file originated, or identifying which package needs to be installed to provide a missing executable or library. It requires a database that maps files to the packages which provide them, so `pkgfile` needs to be updated periodically to have an accurate picture of the system.

It can search using patterns or exact matches. When invoked without arguments, `pkgfile` attempts to update its file database. Its functionality simplifies package management and troubleshooting on Arch-based systems.

CAVEATS

The `pkgfile` database must be regularly updated to ensure accurate results. Old or missing databases can lead to incorrect or incomplete information.

USAGE EXAMPLES

Find the package containing a specific file:
`pkgfile /usr/bin/gcc`

Update the database:
`pkgfile --update`

Search for files with a specific name pattern:
`pkgfile *.so`

HISTORY

`pkgfile` was specifically created to address the need for a file-to-package lookup tool in Arch Linux. Its development aimed to provide a faster and more efficient alternative to methods involving `pacman`'s query capabilities.

Over time, it has seen updates to improve database management, search efficiency, and support for various package management features.

It is now a core utility for Arch Linux users and is commonly used in scripts and command-line workflows for package management and system administration.

SEE ALSO

pacman(8), yay(1), apt-file(1)

Copied to clipboard