Difference between revisions of "Pkgfile"

From ArchWiki
Jump to: navigation, search
(code improvements; easier to read this way)
Line 1: Line 1:
{{DISPLAYTITLE:pkgfile}}
+
{{Lowercase title}}
 
[[Category:Package development]]
 
[[Category:Package development]]
 
[[Category:Package management]]
 
[[Category:Package management]]
 
'''pkgfile''' is a tool that tells you which package owns a specified file or which files a given package provides.
 
'''pkgfile''' is a tool that tells you which package owns a specified file or which files a given package provides.
  
You can [[pacman|install]] it with {{pkg|pkgfile}} from the [[Official Repositories|official repositories]] or with {{AUR|pkgfile-git}} from the [[Arch User Repository]].
+
You can install {{pkg|pkgfile}} from the [[Official Repositories|official repositories]], or {{AUR|pkgfile-git}} from the [[Arch User Repository]].
 +
 
 +
# pacman -S pkgfile
 +
 
 +
Then update the file database, as root:
  
After installing the package, you should update the file list database as root:
 
 
  # pkgfile --update
 
  # pkgfile --update
  
Example:
+
==== Example: ====
{{hc|$ pkgfile makepkg    # Search for a package that contains a file named 'makepkg'.|
+
core/pacman          # Your searched file is in the 'pacman' package in the [core] repository.
+
}}
+
  
Example 2:
+
{{hc|$ pkgfile makepkg    #Search for a package that contains a file named 'makepkg'.|
{{hc|$ pkgfile --list core/archlinux-keyring   # List all files provided by the 'archlinux-keyring' package in the [core] repository.|
+
core/pacman          #Your searched file is in the 'pacman' package in the [core] repository.}}
 +
 
 +
Another example:
 +
 
 +
{{hc|$ pkgfile --list core/archlinux-keyring   #List all files provided by the 'archlinux-keyring' package in the [core] repository.|
 
core/archlinux-keyring usr/
 
core/archlinux-keyring usr/
 
core/archlinux-keyring usr/share/
 
core/archlinux-keyring usr/share/
Line 22: Line 26:
 
core/archlinux-keyring usr/share/pacman/keyrings/archlinux-revoked
 
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-trusted
core/archlinux-keyring usr/share/pacman/keyrings/archlinux.gpg
+
core/archlinux-keyring usr/share/pacman/keyrings/archlinux.gpg}}
}}
+
 
 +
=== "Command not found" hook ===
  
=="Command not found" hook==
 
 
pkgfile includes a "command not found" hook that will automatically search the [[official repositories]], if you enter an unrecognized command.
 
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. E.g. for [[Bash]]:
+
To enable it in all children shells, you need to source the hook from one of your shell initialization files.
{{hc|~/.bashrc|source /usr/share/doc/pkgfile/command-not-found.bash}}
+
 
And for [[Zsh]]:
+
* Example for [[Bash]]:
{{hc|~/.zshrc|source /usr/share/doc/pkgfile/command-not-found.zsh}}
+
 
 +
{{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}}

Revision as of 12:25, 20 September 2012

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 Arch User Repository.

# pacman -S pkgfile

Then update the file database, as root:

# pkgfile --update

Example:

$ pkgfile makepkg     #Search for a package that contains a file named 'makepkg'.
core/pacman           #Your searched file is in the 'pacman' package in the [core] repository.

Another example:

$ pkgfile --list core/archlinux-keyring    #List all files provided by the 'archlinux-keyring' package in the [core] repository.
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