Difference between revisions of "Pkgfile"
|Line 2:||Line 2:|
Revision as of 14:26, 3 March 2014
pkgfile is a tool that tells you which package owns a specified file or which files a given package provides.
Then update the file database:
# pkgfile --update
Example to search for a package that contains a file named "makepkg":
$ pkgfile makepkg
So your searched file is in thepackage from the [core] repository.
Another example to list all files provided by thepackage from the [core] repository:
$ pkgfile --list core/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
"Command not found" hook
pkgfile includes a "command not found" hook that will automatically search the official repositories, if you enter an unrecognized command. Then it will display something like this:
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.
- Example for Bash:
- Example for Zsh:
An alternative "command not found" hook is also provided by the AUR packageAUR, which will generate an output like the following:
The command 'abiword' is been provided by the following packages: abiword (2.8.6-7) from extra [ abiword ] abiword (2.8.6-7) from staging [ abiword ] abiword (2.8.6-7) from testing [ abiword ]
for it to work, add the following to a zshrc:
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh
Written in C++, the command-not-found package is also much faster then pkgfile's Bash scripts.