Difference between revisions of "Pkgfile"

From ArchWiki
Jump to: navigation, search
(Updated "Command not found" - hook in regard of the splitting of pkgtools and pkgfile)
 
(60 intermediate revisions by 30 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:pkgfile}}
+
{{Lowercase title}}
[[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.
+
[[Category:Commands]]
 +
[[cs:Pkgfile]]
 +
[[es:Pkgfile]]
 +
[[fa:Pkgfile]]
 +
[[ja:Pkgfile]]
 +
[[ko:Pkgfile]]
 +
[[pt: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]] it with {{pkg|pkgfile}} from the [[Official Repositories|official repositories]] or with {{AUR|pkgfile-git}} from the [[Arch User Repository]].
+
{{Tip|{{Pkg|pacman}} has [[pacman#Search for a package that contains a specific file|a similar functionality built in]].}}
  
After installing the package, you should update the file list database as root:
+
== Installation ==
# pkgfile --update
 
  
Example:
+
[[Install]] the {{Pkg|pkgfile}} package. Alternatively, install the development version with the {{AUR|pkgfile-git}} package.
$ 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:
+
The ''pkgfile'' database can then be synced with:
$ 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 -u
To make pkgfile automatically print the package you want to install to make some command available, include the following line in {{ic|~/.bashrc}} or {{ic|/etc/bash.bashrc}}:
+
 
source /usr/share/doc/pkgfile/command-not-found.bash
+
== Usage ==
 +
 
 +
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/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 {{ic|pacman -Ql}} (see [[pacman#Querying package databases]]), except it applies to remote packages.
 +
 
 +
== Command not found ==
 +
 
 +
See [[Bash#Command not found]], [[Zsh#The "command not found" hook]] and [[Fish#The "command not found" hook]].
 +
 
 +
== Automatic updates ==
 +
 
 +
'''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}}.
 +
 
 +
By default, pkgfile will be updated daily. To change this schedule, [[systemd#Editing provided units|edit the unit file]].

Latest revision as of 10:13, 21 October 2018

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, Zsh#The "command not found" hook and Fish#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.