PKG-QUERY(1)

NAME
pkg query - query information for installed packages

SYNOPSIS
pkg query -a <query format>
pkg query -f <pkg-name> <query-format>
pkg query [-gxX] <query-format> <pattern> <...>

DESCRIPTION
pkg query is used for displaying information about packages.

OPTIONS
The following options are supported by pkg query:

-a  Match all packages from the database

-f pkg-name
    Display information only for the package file pkg-name

-g  Treat <pattern> as a glob pattern.

-x  Treat <pattern> as a regular expression.

-X  Treat <pattern> as an extended regular expression.

QUERY FORMAT
There are two type of keyword for the query format: the multiline and the normal one. Only one type of multiline pattern is accepted for a given query.

  Normal patterns:

%n  Name of the matched package

%v  Version of the matched package

%o  Origin of the matched package

%p  Prefix of the matched package

%m  Maintainer of the matched package

%c  Comment of the matched package

%w  Home page of the matched package

%l  license logic of the matched package - nothing for single, & for AND, and | for OR

%sh The flat size in human readable format of the matched package

%sb The flat size in bytes of the matched package

%a  Returns 1 if the matched package is an orphan package and can be pkg-autoremove(1)'d, 0 otherwise

%?[drCFIDLUG]
    Returns 0 if the list is empty and 1 if the list has information to display

    d   for dependencies

    r   for reverse dependencies

    C   for categories

    F   for files

    O   for options

    D   for directories

    L   for licenses

    U   for users

    G   for groups

  Multiline patterns:

%d[nov]
    Expands to the list of dependencies for the matched package, where n stand for the package name, o for the package origin, and v for the package version.

%r[nov]
    Expands to the list of reverse dependencies for the matched package, where n stand for the package name, o for the package origin, and v for the package version.

%C  Expands to the list of categories the matched package belongs to.

%F[ps]
    Expands to the list of files of the matched package, where p stand for path, and s for sum.

%O[kv]
    Expands to the list of options of the matched package, where k stand for option key, and v for option value.

%L  Expands to the list of license(s) for the matched package.

%U  Expands to the list of users needed by the matched package.

%G  Expands to the list of groups needed by the matched package.

%S  Expands to the list of scripts for the matching packages - install, deinstall, etc.

ENVIRONMENT
The following environment variables affect the execution of pkg query. See pkg.conf(5) for further description.

FILES
See pkg.conf(5).

SEE ALSO
pkg(1), pkg-add(1), pkg-autoremove(1), pkg-search(1), pkg-backup(1), pkg-install(1), pkg-delete(1), pkg-create(1), pkg-register(1), pkg-repo(1), pkg-update(1), pkg-upgrade(1), pkg-version(1), pkg-which(1), pkg.conf(5)