Difference between revisions of "Pkgfile"

From ArchWiki
Jump to: navigation, search
m ("Command not found" hook)
(simplification and beautification of wikilinks (interactive))
(Tag: wiki-scripts)
 
(40 intermediate revisions by 26 users not shown)
Line 2: Line 2:
 
[[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.
+
[[es:Pkgfile]]
 +
[[fa:Pkgfile]]
 +
[[ja:Pkgfile]]
 +
[[ko:Pkgfile]]
 +
[[ru:Pkgfile]]
 +
[[zh-hans:Pkgfile]]
 +
{{Related articles start}}
 +
{{Related|pacman}}
 +
{{Related articles end}}
 +
'''pkgfile''' is a tool for searching files from packages in the [[official repositories]].
  
You can [[Pacman|install]] {{pkg|pkgfile}} from the [[Official Repositories]], or {{AUR|pkgfile-git}} from the [[AUR]].
+
{{Tip|Note since {{Pkg|pacman}} version 5.0 
 +
[[pacman#Search for a package that contains a specific file|a similar functionality is built in]].}}
 +
== Installation ==
  
Then update the file database, as root:
+
[[Install]] {{Pkg|pkgfile}} from the official repositories, or {{AUR|pkgfile-git}} from the [[AUR]].
  
# pkgfile --update
+
The ''pkgfile'' database can then be synced with:
  
==== Example: ====
+
# pkgfile -u
  
{{hc|$ pkgfile ''makepkg''    #Search for a package that contains a file named "makepkg".|
+
== Usage ==
core/pacman          #Your searched file is in the {{Pkg|pacman}} package from the [core] repository.}}
 
  
Another example:
+
To search for a package that owns the file {{ic|makepkg}}:
  
{{hc|$ pkgfile --list ''core/archlinux-keyring''    #List all files provided by the {{Pkg|archlinux-keyring}} package from the [core] repository.|
+
{{hc|$ pkgfile makepkg|
 +
core/pacman}}
 +
 
 +
To list all files provided by {{Pkg|archlinux-keyring}}:
 +
 
 +
{{hc|$ pkgfile -l archlinux-keyring|
 
core/archlinux-keyring usr/
 
core/archlinux-keyring usr/
 
core/archlinux-keyring usr/share/
 
core/archlinux-keyring usr/share/
Line 26: Line 41:
 
core/archlinux-keyring usr/share/pacman/keyrings/archlinux.gpg}}
 
core/archlinux-keyring usr/share/pacman/keyrings/archlinux.gpg}}
  
=== "Command not found" hook ===
+
Latter is comparable to {{ic|pacman -Ql}} (see [[pacman#Querying package databases]]), except it applies to remote packages.
 
 
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]]:
+
== Command not found ==
  
{{hc|~/.bashrc|
+
See [[Bash#Command not found]] and [[Zsh#The "command not found" hook]].
source /usr/share/doc/pkgfile/command-not-found.bash}}
 
  
* Example for [[Zsh]]:
+
== Automatic updates ==
  
{{hc|~/.zshrc|
+
'''pkgfile''' ships with a [[systemd]] service and [[systemd/Timers|timer]] for automatically synchronizing the pkgfile database. To activate automatic updates [[enable]] {{ic|pkgfile-update.timer}}.
source /usr/share/doc/pkgfile/command-not-found.zsh}}
 
  
==See also==
+
By default, pkgfile will be updated daily. To change this schedule, [[systemd#Editing provided units|edit the unit file]].
* [[Bash#The_"command_not_found"_hook]] - A section comparing {{Pkg|pkgfile}} and {{AUR|command-not-found}}
 

Latest revision as of 17:07, 17 May 2017

Related articles

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

Tip: Note since pacman version 5.0 a similar functionality is built in.

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

See Bash#Command not found and Zsh#The "command not found" hook.

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.