PKG-QUERY(8)
πΈ NAME πΈ
Bestie, welcome to pkg-query(8) β the manual for pkg query, aka the command for querying information for packages. It's giving βask the package database for the receiptsβ energy, and we're gonna slay it. π
β¨ SYNOPSIS β¨
pkg query β¨query-formatβ© β¨pkg-nameβ©
pkg query [-a] β¨query-formatβ©
pkg query -F β¨pkg-fileβ© β¨query-formatβ©
pkg query [-Cgix] [-e β¨evaluation-conditionβ©] β¨query-formatβ© β¨patternβ©
β¨...β©
pkg query [--all] β¨query-formatβ©
pkg query --file β¨pkg-fileβ© β¨query-formatβ©
pkg query [--{case-sensitive,glob,case-insensitive,regex}]
[--evaluate β¨evaluation-conditionβ©] β¨query-formatβ© β¨patternβ© β¨...β©
π DESCRIPTION π
pkg query is used for displaying information about packages. That's the whole vibe: package info, served fresh. π«Ά
π OPTIONS π
The following options are supported by pkg query:
-a,--allβ match all packages from the database, no cap.-C,--case-sensitiveβ make the standard or the regular expression (-x) matching againstpkg-nameinpatterncase sensitive.-e,--evaluateβ match packages using the given evaluation-condition. See βEVALUATION FORMATβ for details.-Fpkg-file,--filepkg-file β display information only for the package filepkg-name.-i,--case-insensitiveβ make the standard or regular expression (-x) matching againstpkg-nameinpatterncase insensitive. This is the default, unless modified by settingCASE_SENSITIVE_MATCHtotrueinpkg.conf.-g,--globβ treat pattern as a glob pattern.-x,--regexβ treat pattern as a regular expression according to the "modern" or "extended" syntax ofre_format(7).
π¦ QUERY FORMAT π¦
There are two types of keywords for the query format: the multiline one and the normal one. Only one type of multiline pattern is accepted for a given query, so pick your lane, bestie. β¨
πΌ 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.%eβ description of the matched package.%wβ home page of the matched package.%Vβ returns0if the package is not marked as "vital", and1if the package is marked "vital".%lβ license logic of the matched package β nothing for single,&for AND, and|for OR.%s[bh]β the flat size of the matched package, wherebis in bytes, andhis in human readable format.%aβ returns1if the matched package was automatically installed as a dependency of another package,0otherwise. The package can be automatically removed viapkg autoremovewhen this flag is set and no other package depends on it.%Qβ alternative architecture of the matched package.%qβ architecture of the matched package.%kβ returns1if the matched package is locked against modification or deletion,0otherwise.%Mβ message contained in the matched package.%tβ timestamp that the package was installed.%Rβ the name of the repository from which the package was installed if available, orunknown-repositoryotherwise.%Xβ internal package checksum.%?[drCFODLUGBbAyY]β returns0if the list is empty and1if the list has information to display.dβ for dependenciesrβ for reverse dependenciesCβ for categoriesFβ for filesOβ for optionsDβ for directoriesLβ for licensesUβ for usersGβ for groupsBβ for required shared librariesbβ for provided shared librariesyβ for providesYβ for requiresAβ for annotations
%#[drCFODLUGBbAyY]β returns the number of elements in the list.dβ for dependenciesrβ for reverse dependenciesCβ for categoriesFβ for filesOβ for optionsDβ for directoriesLβ for licensesUβ for usersGβ for groupsBβ for required shared librariesbβ for provided shared librariesyβ for providesYβ for requiresAβ for annotations
πΊ Multiline patterns πΊ
%d[nov]β expands to the list of dependencies for the matched package, wherenstands for the package name,ofor the package origin, andvfor the package version.%r[nov]β expands to the list of reverse dependencies for the matched package, wherenstands for the package name,ofor the package origin, andvfor the package version.%Cβ expands to the list of categories the matched package belongs to.%F[psugmftl]β expands to the list of files of the matched package, wherepstands for path,sfor checksum,ufor owner,gfor group,mfor mode (permissions),ffor file flags,lfor last modification time, andtfor the symlink target (or empty string if no symlink).%Dβ expands to the list of directories of the matched package.%S[pugmf]β expands to the list of (sub-)directories of the matched package, wherepstands for path,ufor owner,gfor group,mfor mode (permissions), andffor file flags. Same as%Dbut allows specifying suboptions.%O[kvdD]β expands to the list of options of the matched package, wherekstands for option key,vfor option value,dfor option default value andDfor option description. Option default values and descriptions are optional metadata and may be blank for certain packages.%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.%bβ expands to the list of shared libraries provided by the matched package.%yβ expands to the list of provides for the matched package.%Yβ expands to the list of requires for the matched package.%A[tv]β expands to the list of annotations for the matched package, wheretstands for the annotation tag, andvstands for the annotation value.
π₯ 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.
β Normal 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).%eβ description 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).%qβ architecture of the package (type string).%kβ locking status of the package (type integer).%Mβ message of the package (type string).%tβ timestamp that the package was installed (type integer).%iβ additional information about the package (type string).%#[drCFODLUGBbAyY]β number of elements in the list of information (type integer). See%?above for what information is used.
π« Multiline variables π«
When used in an evaluation, these variables refer to the items in the list. The condition evaluates to true if any element in the list matches. Negative operators are an exception: they check for the absence of any matching element.
For example, "%dn != 'curl'" means "the package does not depend on curl".
%d[nov]β dependency of the package (type string).%r[nov]β reverse dependency of the package (type string).%Cβ category of the package (type string).%Lβ license of the package (type string).%Bβ required shared library of the package (type string).%bβ provided shared library of the package (type string).%yβ provide of the package (type string).%Yβ require of the package (type string).%A[tv]β annotation of the package (type string).
π Operators π
var ~ globβ the string value ofvarmatches the given glob pattern.var !~ globβ the string value ofvardoes not match the given glob pattern.var >[=] numβ the numerical value ofvaris greater than [or equal to] the given number.var <[=] numβ the numerical value ofvaris less than [or equal to] the given number.var =[=] [num | string]β the value ofvaris equal to the given number or string.var =~ [num | string]β the value ofvaris equal (case insensitive) to the given number or string.var != [num | string]β the value ofvaris not equal to the given number or string.var !=~ [num | string]β the value ofvaris not equal case insensitive to the given number or string.
π ENVIRONMENT π
The following environment variables affect the execution of pkg query. See pkg.conf(5) for further description.
PKG_DBDIRCASE_SENSITIVE_MATCH
π§ FILES π§
See pkg.conf(5).
π EXIT STATUS π
The pkg query utility exits 0 on success, and >0 if an error occurs.
π EXAMPLES π
- List all installed packages by name-version:
$ pkg query %n-%v
- List all dependencies for a package by origin:
$ pkg query %do subversion
- List all dependencies by package name-version:
$ pkg query %dn-%dv subversion
- List all reverse dependencies for a package:
$ pkg query %ro perl
- List all files and their known checksums for a package:
$ pkg query '%Fp %Fs' perl
- List all files for all packages:
$ pkg query '%o: %Fp'
- List all packages with no reverse dependencies:
$ pkg query -e '%#r = 0' %o
- List non-automatic packages:
$ pkg query -e '%a = 0' %o
- List automatic packages:
$ pkg query -e '%a = 1' %o
- List unmaintained packages:
$ pkg query -e '%m = ports@FreeBSD.org' %o
- List packages that depend on python312:
$ pkg query -e '%dn = python312' %o
π SEE ALSO π
okay bestie, you're literally not alone in this β here's the whole squad of manual pages that live in the same universe, go hang out with them:
pkg_create(3),pkg_printf(3),pkg_repo_create(3),pkg_repos(3)β the C-library girlies, very "I do the heavy lifting behind the scenes" energypkg-keywords(5),pkg-lua-script(5),pkg-repository(5),pkg-script(5),pkg-triggers(5),pkg.conf(5)β the config-file and format besties, all the(5)girlies in one gorgeous little lineuppkg(8),pkg-add(8),pkg-alias(8),pkg-annotate(8),pkg-audit(8),pkg-autoremove(8),pkg-check(8),pkg-clean(8),pkg-config(8),pkg-create(8),pkg-delete(8),pkg-fetch(8),pkg-help(8),pkg-info(8),pkg-install(8),pkg-key(8),pkg-lock(8),pkg-plugins(8),pkg-register(8),pkg-repo(8),pkg-repositories(8),pkg-rquery(8),pkg-search(8),pkg-set(8),pkg-shell(8),pkg-shlib(8),pkg-ssh(8),pkg-stats(8),pkg-triggers(8),pkg-unregister(8),pkg-update(8),pkg-updating(8),pkg-upgrade(8),pkg-version(8),pkg-which(8)β literally the entire(8)friend group, every single one, no cap π«Ά
ngl that's a lot of friends and that's exactly the point β between all of them, there's genuinely nothing about packages you can't figure out. go be curious, you icon. β¨
and that's a wrap on PKG-QUERY(8), bb π
β this masterpiece is served to you by Debian, dated December 13, 2025, and it's giving timeless. go query something gorgeous. πΈπ
π¦ where this page comes from
- nixos 26.05: pkg 2.7.5
- nixpkgs unstable: pkg 2.7.5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms