Difference between revisions of "Pkgfile"

From ArchWiki
Jump to: navigation, search
m (Redirected page to Pkgtools)
m (Format)
(22 intermediate revisions by 9 users not shown)
Line 1: Line 1:
#REDIRECT [[pkgtools]]
+
{{Lowercase title}}
 +
[[Category:Package development]]
 +
[[Category:Package management]]
 +
[[ko:Pkgfile]]
 +
[[zh-CN:Pkgfile]]
 +
'''pkgfile''' is a tool that tells you which package owns a specified file or which files a given package provides.
 +
 
 +
You can [[pacman|install]] {{Pkg|pkgfile}} from the [[official repositories]], or {{AUR|pkgfile-git}} from the [[AUR]].
 +
 
 +
Then update the file database:
 +
 
 +
# pkgfile --update
 +
 
 +
==== Example: ====
 +
 
 +
Example to search for a package that contains a file named "makepkg":
 +
 
 +
{{hc|$ pkgfile makepkg|
 +
core/pacman}}
 +
So your searched file is in the {{Pkg|pacman}} package from the [core] repository.
 +
 
 +
Another example to list all files provided by the {{Pkg|archlinux-keyring}} package from the [core] repository.:
 +
 
 +
{{hc|$ 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.
 +
 
 +
To enable it in all children shells, you need to source the hook from one of your shell initialization files.
 +
 
 +
* Example for [[Bash]]:
 +
 
 +
{{hc|~/.bashrc|
 +
source /usr/share/doc/pkgfile/command-not-found.bash}}
 +
 
 +
* Example for [[Zsh]]:
 +
 
 +
{{hc|~/.zshrc|
 +
source /usr/share/doc/pkgfile/command-not-found.zsh}}
 +
 
 +
==See also==
 +
* [[Bash#The_"command_not_found"_hook]] - Section comparing {{Pkg|pkgfile}} and {{AUR|command-not-found}}

Revision as of 08:52, 13 June 2013

pkgfile is a tool that tells you which package owns a specified file or which files a given package provides.

You can install pkgfile from the official repositories, or pkgfile-gitAUR from the AUR.

Then update the file database:

# pkgfile --update

Example:

Example to search for a package that contains a file named "makepkg":

$ pkgfile makepkg
core/pacman

So your searched file is in the pacman package from the [core] repository.

Another example to list all files provided by the archlinux-keyring package 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.

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

~/.bashrc
source /usr/share/doc/pkgfile/command-not-found.bash
  • Example for Zsh:
~/.zshrc
source /usr/share/doc/pkgfile/command-not-found.zsh

See also