PKG-QUERY(8)

NAME
pkg query - query information for installed packages

SYNOPSIS
pkg query <query-format> <pkg-name>
pkg query [-a] <query-format>
pkg query -F <pkg-name> <query-format>
pkg query -e <evaluation-condition> <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

-e  Match packages using the given evaluation-condition. See EVALUATION FORMAT for details.

-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

%i  Additionnal information about the package

%w  Home page of the matched package

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

%s[bh]
    The flat size of the matched package, where b is in bytes, and h is in human readable format.

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

%M  message contain in the matched package

%t  Timestamp that the package was installed

%?[drCFODLUGB]
    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

    B   for shared libraries

  Multiline patterns:

%d[nov]
    Expands to the list of dependencies for the matched package, where n stands 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 stands 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 stands for path, and s for sum.

%D  Expands to the list of directories of the matched package.

%O[kv]
    Expands to the list of options of the matched package, where k stands 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.

%B  Expands to the list of shared libraries used by programs from the matched package.

EVALUATION FORMAT
Packages can be selected by using expressions comparing Variables (see below) to string or integer values. The mode of comparison is specified by the Operator (also listed below). Expressions can be combined using && (for and) and || (for or). Parentheses can be used for grouping in the usual manner.

String values are either any text not containing whitespace (possibly followed by but not including whitespace) or any text enclosed in single or double quotes.

  Variables

%n  Name of the package (type string)

%o  Origin of the package (type string)

%p  Prefix of the package (type string)

%m  Maintainer of the package (type string)

%c  Comment of the package (type string)

%w  WWW address of the package (type string)

%s  Flatsize of the package (type integer)

%a  Automatic status of the package (type integer)

%M  Message of the package (type string)

%t  Timestamp that the package was installed (type integer)

%i  Additionnal information about the package (type string)

%#[drCFODLUGB]
    Number of elements in the list of information (type integer). See %? above for what information is used.

  Operators

~   String glob pattern matching

>[=]
    Integer comparison

<[=]
    Integer comparison

=[=]
    Integer or string equality comparison

!=  Integer or string inequality comparison

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

PKG_DBDIR

FILES
See pkg.conf(5).

SEE ALSO
pkg(8), pkg-add(8), pkg-audit(8), pkg-autoremove(8), pkg-backup(8), pkg-check(8), pkg-clean(8), pkg-create(8), pkg-delete(8), pkg-fetch(8), pkg-info(8), pkg-install(8), pkg-register(8), pkg-repo(8), pkg-rquery(8), pkg-search(8), pkg-set(8), pkg-shell(8), pkg-shlib(8), pkg-stats(8), pkg-update(8), pkg-updating(8), pkg-upgrade(8), pkg-version(8), pkg-which(8), pkg.conf(5)