pquery [-h] [–version] [–debug] [-q] [-v] [–color BOOLEAN] [–config CONFIG_PATH] [–domain DOMAIN] [–raw] [–unfiltered] [–virtuals {only,disable}] [-r REPO | -E | -B | -I | -A] [–all] [–has-use has_use] [–license license] [–revdep REVDEP] [–revdep-pkgs REVDEP_PKGS] [–restrict-revdep restrict_revdep] [–restrict-revdep-pkgs restrict_revdep_pkgs] [-S description] [–eapi eapi] [–owns owns] [–owns-re owns_re] [–maintainer maintainer] [–maintainer-name maintainer_name] [–maintainer-email maintainer_email] [–environment-re environment_re] [–pkgset pkgset] [-u] [-1] [-a] [–cpv] [-R] [–slot] [-n | –min | –max] [–blame] [–size] [–contents] [–highlight-dep HIGHLIGHT_DEP] [–print-revdep PRINT_REVDEP] [–attr attribute] [–force-attr attribute] [–one-attr attribute | –force-one-attr attribute] [TARGET …]

Base Options

-h, --help

show this help message and exit


show this program’s version info and exit


enable debugging checks

-q, --quiet

suppress non-error messages

-v, --verbose

show verbose output

--color BOOLEAN

enable/disable color support

Config Options

--config CONFIG_PATH

use custom config or skip loading system config

--domain DOMAIN

custom pkgcore domain to use for this operation

Repository Matching Options

options controlling which repos to inspect


disable configuration filtering


disable all license and visibility filtering

--virtuals {only,disable}

only match virtuals or disable virtuals matching entirely

-r REPO, --repo REPO

repo to search (default from domain if omitted)

-E, --ebuild-repos

search all ebuild repos

-B, --binary-repos

search all binary repos

-I, --installed

search installed packages

-A, --all-repos

search all repos

Package Matching Options


extended atom matching of pkgs


match all packages

--has-use has_use

exact string match on a USE flag

--license license

exact match on a license

--revdep REVDEP

shorthand for –restrict-revdep atom –print-revdep atom

--revdep-pkgs REVDEP_PKGS

shorthand for –restrict-revdep-pkgs atom –print-revdep atom

--restrict-revdep restrict_revdep

dependency on an atom

--restrict-revdep-pkgs restrict_revdep_pkgs

dependency on pkgs that match a specific atom

-S description, --description description

regexp search on description and longdescription

--eapi eapi

match packages using a given EAPI

--owns owns

exact match on an owned file/dir

--owns-re owns_re

like “owns” but using a regexp for matching

--maintainer maintainer

regex to search for maintainers

--maintainer-name maintainer_name

comma-separated list of maintainer name regexes to search for

--maintainer-email maintainer_email

comma-separated list of maintainer email regexes to search for

--environment-re environment_re

regexp search of lines in environment.bz2

--pkgset pkgset

find packages that match the given package set (world for example)

-u, --upgrade

match installed packages without best slotted version

Output Options

-1, --first

stop when first match is found

-a, --atom

print =cat/pkg-3 instead of cat/pkg-3.


print the category/package-version


print the repo of the package


print the slot of the package

-n, --no-version

collapse multiple matching versions together


show only the lowest version for each package


show only the highest version for each package


shorthand for –attr maintainers


display size of all files owned by the package


list files owned by the package

--highlight-dep HIGHLIGHT_DEP

highlight dependencies matching this atom

--print-revdep PRINT_REVDEP

print what condition(s) trigger a dep

--attr attribute

print this attribute’s value (can be specified more than once)

--force-attr attribute

like –attr but accepts any string as attribute name instead of only explicitly supported names

--one-attr attribute

print one attribute, suppresses other output

--force-one-attr attribute

like –one-attr but accepts any string as attribute name instead of only explicitly supported names


Another switch that could do with some extra explanation is --raw. Specifying --raw makes your configuration not affect the results. Example:

$ pquery --attr alldepends sys-apps/dbus --max -v
* sys-apps/dbus-0.62-r1
    description: A message bus system, a simple way for applications to talk
                 to each other
    homepage: http://dbus.freedesktop.org/
    depends: >=dev-libs/glib-2.6 || ( ( x11-libs/libXt x11-libs/libX11 )
                 virtual/x11 ) >=x11-libs/gtk+-2.6 >=dev-lang/python-2.4
                 >=dev-python/pyrex-0.9.3-r2 >=dev-libs/expat-1.95.8
                 dev-util/pkgconfig sys-devel/automake
                 >=sys-devel/autoconf-2.59 sys-devel/libtool
    rdepends: >=dev-libs/glib-2.6 || ( ( x11-libs/libXt x11-libs/libX11 )
                 virtual/x11 ) >=x11-libs/gtk+-2.6 >=dev-lang/python-2.4
                 >=dev-python/pyrex-0.9.3-r2 >=dev-libs/expat-1.95.8

This is the highest unmasked package on the system. Also notice there are no references to USE flags or qt in the dependencies. That is because qt is not in USE for this configuration, so those dependencies do not apply.:

$ pquery --attr alldepends sys-apps/dbus --max -v --raw
* sys-apps/dbus-0.91
    description: Meta package for D-Bus
    homepage: http://dbus.freedesktop.org/
    rdepends: >=sys-apps/dbus-core-0.91 python? (
                 >=dev-python/dbus-python-0.71 ) qt3? (
                 >=dev-libs/dbus-qt3-old-0.70 ) gtk? (
                 >=dev-libs/dbus-glib-0.71 ) !<sys-apps/dbus-0.91

This version is in package.mask, and we can see the use-conditional flags now.

The --verbose or -v flag tries to print human-readable output (although some things like the formatting of depend strings need some improvement). Without -v the output is usually a single line per package in a hopefully machine-parseable format (usable in pipelines). There are some extras like --atom meant for shell pipeline use. If you have some useful shell pipeline in mind that pquery’s output could be better formatted for please open an issue.

Adding short options is planned but there are some features to add first (want most of the features in place to avoid name clashes).


Other tool



equery belongs /bin/ls

pquery --owns /bin/ls

equery check

not implemented (yet?)

equery depends python

pquery -I --revdep dev-lang/python

omitting -I makes it equivalent to equery depends -a

equery depgraph

not implemented (yet?)

equery files python

pquery --contents python

--contents is an output option, can be combined with any restriction

equery hasuse python

pquery -I --has-use python

equery list python

pquery -I '*python*'

this is in ExtendedAtomSyntax

equery size python

pquery --size python

equery uses python

pquery --attr use python

less information, but is an output option so mixes with any restriction

emerge -s python

pquery -vn '*python*'

emerge -S python

pquery -vnS python

searches through longdescription (from metadata.xml) too

no equivalent

pquery --license GPL-2 -I

list all installed GPL-2 packages

no equivalent

pquery --maintainer radhermit

list all packages that are maintained by radhermit

It can also do some things equery/emerge do not let you do, like restricting based on maintainer or herd and printing various other package attributes. See --help for those. If you miss a query open an issue.