pkgfile

From ArchWiki
Jump to: navigation, search

Related articles

pkgfile is a tool for searching files from packages in the official repositories.

Installation

Install pkgfile from the official repositories, or pkgfile-gitAUR from the AUR.

The pkgfile database can then be synced with:

# pkgfile -u

Usage

To search for a package that owns the file makepkg:

$ pkgfile makepkg
core/pacman

To list all files provided by archlinux-keyring:

$ pkgfile -l archlinux-keyring
core/archlinux-keyring usr/
core/archlinux-keyring usr/share/
core/archlinux-keyring usr/share/pacman/
core/archlinux-keyring usr/share/pacman/keyrings/
core/archlinux-keyring usr/share/pacman/keyrings/archlinux-revoked
core/archlinux-keyring usr/share/pacman/keyrings/archlinux-trusted
core/archlinux-keyring usr/share/pacman/keyrings/archlinux.gpg

Latter is comparable to pacman -Ql (see pacman#Querying package databases), except it applies to remote packages.

Command not found

pkgfile includes a "command not found" hook for Bash and Zsh that will automatically search the official repositories, when entering an unrecognized command:

$ abiword
abiword may be found in the following packages:
  extra/abiword 2.8.6-7 usr/bin/abiword

To enable it in all children shells, you need to source the hook from one of your shell initialization files.

Bash

~/.bashrc
source /usr/share/doc/pkgfile/command-not-found.bash

Zsh

~/.zshrc
source /usr/share/doc/pkgfile/command-not-found.zsh

Fish

Fish provides its own "command not found" hook for pkgfile: Add command-not-found handler for Arch Linux #1925

Automatic updates

pkgfile ships with a systemd service and timer for automatically synchronizing the pkgfile database. To activate automatic updates enable pkgfile-update.timer.

By default, pkgfile will be updated daily. To change this schedule, edit the unit file.