Difference between revisions of "Pkgfile"

From ArchWiki
Jump to: navigation, search
m (small style fixes (Help:Style))
 
(24 intermediate revisions by 15 users not shown)
Line 1: Line 1:
 
{{Lowercase title}}
 
{{Lowercase title}}
[[Category:Package development]]
 
 
[[Category:Package management]]
 
[[Category:Package management]]
 +
[[Category:Commands]]
 +
[[cs:Pkgfile]]
 +
[[es:Pkgfile]]
 +
[[fa:Pkgfile]]
 
[[ja:Pkgfile]]
 
[[ja:Pkgfile]]
 
[[ko:Pkgfile]]
 
[[ko:Pkgfile]]
 +
[[pt:Pkgfile]]
 
[[ru:Pkgfile]]
 
[[ru:Pkgfile]]
[[zh-CN:Pkgfile]]
+
[[zh-hans:Pkgfile]]
 
{{Related articles start}}
 
{{Related articles start}}
 
{{Related|pacman}}
 
{{Related|pacman}}
 
{{Related articles end}}
 
{{Related articles end}}
 
'''pkgfile''' is a tool for searching files from packages in the [[official repositories]].
 
'''pkgfile''' is a tool for searching files from packages in the [[official repositories]].
 +
 +
{{Tip|{{Pkg|pacman}} has [[pacman#Search for a package that contains a specific file|a similar functionality built in]].}}
  
 
== Installation ==
 
== Installation ==
  
[[Install]] {{Pkg|pkgfile}} from the official repositories, or {{AUR|pkgfile-git}} from the [[AUR]].
+
[[Install]] the {{Pkg|pkgfile}} package. Alternatively, install the development version with the {{AUR|pkgfile-git}} package.
  
 
The ''pkgfile'' database can then be synced with:
 
The ''pkgfile'' database can then be synced with:
Line 41: Line 47:
 
== Command not found ==
 
== Command not found ==
  
pkgfile includes a "command not found" hook for [[Bash]] and [[Zsh]] that will automatically search the official repositories, when entering an unrecognized command:
+
See [[Bash#Command not found]], [[Zsh#The "command not found" hook]] and [[Fish#The "command not found" hook]].
 
 
{{hc|$ 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.
 
 
 
=== Bash ===
 
 
 
{{hc|~/.bashrc|
 
source /usr/share/doc/pkgfile/command-not-found.bash}}
 
 
 
=== Zsh ===
 
 
 
{{hc|~/.zshrc|
 
source /usr/share/doc/pkgfile/command-not-found.zsh}}
 
 
 
=== Fish ===
 
 
 
{{Pkg|pkgfile}} does not provide a hook specifically for [[Fish]], but it is sufficient to define your own {{ic|command-not-found}} function, which will be run when Fish encounters an unknown command:
 
 
 
{{hc|~/.config/fish/functions/command-not-found.fish|
 
function command-not-found
 
        set cmd $argv[2]
 
        set pkgs (pkgfile -b -v $argv 2>/dev/null)
 
        if test -n $pkgs
 
                echo "$cmd may be found in the following packages:"
 
                echo "$pkgs"
 
                return 0
 
        end
 
        return 127
 
end}}
 
  
 
== Automatic updates ==
 
== Automatic updates ==
  
'''pkgfile''' ships with a [[systemd]] [[systemd/Services|service]] and [[systemd/Timers|timer]] for automatically synchronizing the pkgfile database. To activate automatic updates [[enable]] {{ic|pkgfile-update.timer}}.
+
'''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, copy {{ic|/usr/lib/systemd/system/pkgfile-update.timer}} to {{ic|/etc/systemd/system/pkgfile-update.timer}} and edit the latter file.
+
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.