Difference between revisions of "Pkgfile"

From ArchWiki
Jump to: navigation, search
(Undo revision 317450 by Bluestreak0 (talk) pkgfile-git is in the AUR)
(remove section wholly unrelated to pkgfile)
Line 54: Line 54:
 
{{hc|~/.zshrc|
 
{{hc|~/.zshrc|
 
source /usr/share/doc/pkgfile/command-not-found.zsh}}
 
source /usr/share/doc/pkgfile/command-not-found.zsh}}
 
=== command-not-found (AUR) ===
 
 
An alternative "command not found" hook is provided by the AUR package {{AUR|command-not-found}}:
 
 
{{hc|$ abiword|
 
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 ]
 
}}
 
 
To load it automatically:
 
 
{{hc|''~/.bashrc'' or ''~/.zshrc''|
 
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh
 
}}
 

Revision as of 21:17, 12 August 2014

zh-CN:Pkgfile

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

"Command not found" hook

pkgfile includes a "command not found" hook 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.

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