Difference between revisions of "Pkgfile"

From ArchWiki
Jump to: navigation, search
m ("Command not found" hook)
m (Fix typo)
 
(45 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|{{Pkg|pacman}} has [[pacman#Search for a package that contains a specific file|a similar functionality built in]].}}
  
Then update the file database, as root:
+
== Installation ==
  
# pkgfile --update
+
[[Install]] the {{Pkg|pkgfile}} package. Alternatively, install the development version with the {{AUR|pkgfile-git}} package.
  
==== Example: ====
+
The ''pkgfile'' database can then be synced with:
  
{{hc|$ pkgfile ''makepkg''    #Search for a package that contains a file named "makepkg".|
+
# pkgfile -u
core/pacman          #Your searched file is in the {{Pkg|pacman}} package from the [core] repository.}}
 
  
Another example:
+
== Usage ==
  
{{hc|$ pkgfile --list ''core/archlinux-keyring''    #List all files provided by the {{Pkg|archlinux-keyring}} package from the [core] repository.|
+
To search for a package that owns the file {{ic|makepkg}}:
 +
 
 +
{{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 09:38, 19 August 2017

Related articles

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

Installation

Install the pkgfile package. Alternatively, install the development version with the pkgfile-gitAUR package.

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.