Difference between revisions of "Pkgfile"

From ArchWiki
Jump to: navigation, search
(Example:)
(Command not found: fix link)
 
(42 intermediate revisions by 23 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-CN:Pkgfile]]
 +
{{Related articles start}}
 +
{{Related|pacman}}
 +
{{Related articles end}}
 +
'''pkgfile''' is a tool for searching files from packages in the [[official repositories]].
  
You can install {{pkg|pkgfile}} from the [[Official Repositories|official repositories]], or {{AUR|pkgfile-git}} from the [[Arch User Repository]].
+
== Installation ==
  
# pacman -S pkgfile
+
[[Install]] {{Pkg|pkgfile}} from the official repositories, or {{AUR|pkgfile-git}} from the [[AUR]].
  
Then update the file database, as root:
+
The ''pkgfile'' database can then be synced with:
  
  # pkgfile --update
+
  # pkgfile -u
  
==== Example: ====
+
== Usage ==
  
{{hc|$ pkgfile ''makepkg''    #Search for a package that contains a file named "makepkg".|
+
To search for a package that owns the file {{ic|makepkg}}:
core/pacman          #Your searched file is in the {{Pkg|pacman}} package from the [core] repository.}}
+
  
Another example:
+
{{hc|$ pkgfile makepkg|
 +
core/pacman}}
  
{{hc|$ pkgfile --list ''core/archlinux-keyring''    #List all files provided by the {{Pkg|archlinux-keyring}} package from the [core] repository.|
+
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 28: Line 39:
 
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.
+
== Command not found ==
  
* Example for [[Bash]]:
+
See [[Bash#Command not found]].
  
{{hc|~/.bashrc|
+
== Automatic updates ==
source /usr/share/doc/pkgfile/command-not-found.bash}}
+
  
* Example for [[Zsh]]:
+
'''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}}.
  
{{hc|~/.zshrc|
+
By default, pkgfile will be updated daily. To change this schedule, [[systemd#Editing provided units|edit the unit file]].
source /usr/share/doc/pkgfile/command-not-found.zsh}}
+

Latest revision as of 22:04, 8 September 2016

Related articles

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

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.

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.