---
name: "pkgfile"
section: "1"
platform: "linux"
package: "pkgfile"
version: "27-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pkgfile"
---

# pkgfile(1)

an alpm .files metadata explorer

## NAME

pkgfile - an alpm .files metadata explorer

## SYNOPSIS

Usage: *pkgfile* \[operation\] \[options\] target

## DESCRIPTION

pkgfile searches the .files metadata created by [**repo-add**(8)](/repo-add/8.md) to retrieve file information about packages. By default, the provided target is considered to be a filename and pkgfile will return the package(s) which contain this file. The repos which pkgfile searches is determined by those enabled in */etc/pacman.conf*.

## OPERATIONS

- **-l**, **--list**

  The target is considered to be a package name rather than a filename, and the contents of the named package are returned. This allows for repo/package style syntax (such as "core/pacman") to limit the breadth of the search, but only when **--list** is used without the **--glob** or **--regex** options.

- **-s**, **--search**

  Search for packages containing the provided target. This is the default mode of operation.

- **-u**, **--update**

  Update the stored metadata files. It is recommended to create a daily cron job with this command to ensure accurate results. By default, only repos which are found to be newer on the mirror will be downloaded. Pass this option twice to force all repos to be downloaded.

## MATCHING

- **-b**, **--binaries**

  Return only files which are contained within a bin or sbin directory.

- **-d**, **--directories**

  Additionally include directories in search results.

- **-g**, **--glob**

  Enable shell-style glob pattern matching. See [**glob**(7)](/glob/7.md). Note that the shell wildcards *\** and *?* will never match path separators. Thus, this kind of matching is useful for searching for entries within directories, e.g. */usr/bin/\**.

- **-i**, **--ignorecase**

  Disable case sensitivity in matching.

- **-r**, **--regex**

  Enable regular expression matching. See [**pcre**(3)](/pcre/3.md).

- **-R** *REPO*, **--repo=***REPO*

  Search only the specific repo.

## OUTPUT

- **-0**, **--null**

  Delimit output with null bytes rather than newline characters.

- **-q**, **--quiet**

  Output less. This applies to the **--list** operation.

- **-v**, **--verbose**

  Output more. This applies to the **--search** operation.

- **-w**, **--raw**

  Avoid justification of 2 column output.

## GENERAL OPTIONS

- **-C** *FILE*, **--config=***FILE*

  Use a config file other than the default of */etc/pacman.conf*.

- **-D** *DIRECTORY*, **--cachedir=***DIRECTORY*

  Use a cache path other than the compile-time default.

- **-h**, **--help**

  Print help and exit.

- **-V**, **--version**

  Print the version and exit.

## MATCHING HEURISTICS

In --search mode and without the --regex or --glob option, pkgfile will attempt to match the provided target as an exact filename. If the target contains a '/' character, a full path match will be attempted. With --regex and --glob enabled searching, pkgfile will always match against the full pathname.

In --list mode and without the --regex or --glob option, pkgfile will attempt to match the provided target as an exact package name. If the target contains a '/' character, the text before the slash will be assumed to be a repository and the search will be restricted.

## COMMAND NOT FOUND HOOKS

- */usr/share/doc/pkgfile/command-not-found.bash*

  - */usr/share/doc/pkgfile/command-not-found.zsh*

  - */usr/share/doc/pkgfile/command-not-found.fish*

  zsh, bash and fish compatible functions which can be included in shell initalization to run pkgfile when an executed command is not found.

  If the environment variable PKGFILE\_PROMPT\_INSTALL\_MISSING is set, and only one package is found, a prompt to install the package will be shown. **NOTE**: this feature requires the [**sudo**(8)](/sudo/8.md) program, and is currently only supported by the bash and zsh implementations.

## AUTOMATING UPDATES

It is recommended to use [**pkgfiled**(1)](/pkgfiled/1.md) to keep .files DBs up as \`pacman -Fy\` is issued (either by a user or a cronjob/systemd timer). pkgfiled can be enabled with:

```
  systemctl enable --now pkgfiled
```

Alternatively, pkgfile includes systemd timer and service units to automate periodic updates to the .files DBs. Assuming that pkgfile was built with systemd support, this can be enabled with:

```
  systemctl enable --now pkgfile-update.timer
```

## SEE ALSO

[**pkgfiled**(1)](/pkgfiled/1.md), [**repo-add**(8)](/repo-add/8.md), [**pcre**(3)](/pcre/3.md), [**glob**(7)](/glob/7.md), [**pacman.conf**(5)](/pacman.conf/5.md)

## AUTHOR

Dave Reisner \<d@falconindy.com\<gt\>
