.\" Generated by scdoc 1.11.5 .\" Complete documentation for this program is not available as a GNU info page .ie \n(.g .ds Aq \(aq .el .ds Aq ' .nh .ad l .\" Begin generated content: .TH "apk\-query" "8" "2026\-08\-31" .PP .SH NAME .PP apk query \- query information about packages by various criteria .PP .SH SYNOPSIS .PP \fBapk query\fR [<\fIoptions\fR>.\&.\&.\&] \fIquery\fR.\&.\&.\& .PP \fBapk query\fR [<\fIoptions\fR>.\&.\&.\&] \fB\-\-recursive\fR \fIconstraints\fR.\&.\&.\& .PP .SH DESCRIPTION .PP \fBapk query\fR searches for matching packages from selected sources.\& .PP In the default mode, \fIquery\fR specifiers are interpreted as follows: .RS 4 \fBname{[<>\(ti=]version}\fR .RS 4 Select packages by \fBname\fR and optional \fBversion\fR match.\& .RE \fBtext\fR .RS 4 Select packages by selected fields matching \fBtext\fR.\& .PP .RE .RE In the \fB\-\-recursive\fR mode, the \fIconstraints\fR specify a list of dependencies to satisfy and the solver algorithm is used to determine a list of packages that fulfil these constraints.\& .PP The query executes in the following steps: .PD 0 .IP 1. 4 Each \fIquery\fR string is executed independently to select candidate packages .IP 2. 4 If \fB\-\-all\-matches\fR is not specified, the best candidate for given term is added to the list of result packages .IP 3. 4 The resulting package list is sorted .PD .PP .SH QUERY OPTIONS .PP The applets supporting query specifiers recognize the following options: .PP \fB\-\-all\-matches\fR .RS 4 Select all matched packages.\& By default only best match for each query element is selected.\& .PP .RE \fB\-\-available\fR .RS 4 Filter selection to available packages.\& .PP .RE \fB\-\-fields\fR \fIFIELDS\fR[:\fIREVERSE_FIELD\fR] .RS 4 A comma separated list of fields to include in the output.\& An optional specification to specify the field to output for the synthetic reverse dependency fields can be specified (\fBname\fR, \fBpackage\fR or \fBorigin\fR).\& .PP .RE \fB\-\-format\fR \fIFORMATSPEC\fR .RS 4 Specify output format from \fBdefault\fR, \fByaml\fR or \fBjson\fR.\& The \fBdefault\fR format is human readable text output.\& .PP .RE \fB\-\-from\fR \fIFROMSPEC\fR .RS 4 Search packages from: \fBsystem\fR (all system sources), \fBrepositories\fR (exclude installed database), \fBinstalled\fR (exclude normal repositories) or \fBnone\fR (command\-line repositories only).\& .PP .RE \fB\-\-installed\fR .RS 4 Filter selection to installed packages.\& .PP .RE \fB\-\-match\fR \fIFIELDS\fR .RS 4 A comma separated list of fields to match the query against.\& .PP .RE \fB\-\-recursive\fR .RS 4 Run solver algorithm with given \fIconstraints\fR to select packages.\& .PP .RE \fB\-\-summarize\fR \fIFIELD\fR[:\fIREVERSE_FIELD\fR] .RS 4 Produce a summary of the specified field from all matches.\& Summary is available on the following fields: \fBpackage\fR, \fBname\fR, \fBorigin\fR, \fBdepends\fR, \fBprovides\fR, \fBreplaces\fR, \fBinstall_if\fR, \fBrecommends\fR, \fBreverse\-depends\fR, and \fBreverse\-install\-if\fR.\& .PP .RE \fB\-\-upgradable\fR .RS 4 Filter selection to upgradable packages.\& .PP .RE \fB\-\-world\fR .RS 4 Include \fBapk\-world\fR(5) dependencies in constraints.\& Implies \fB\-\-recursive\fR.\& .PP .RE \fB\-\-orphaned\fR .RS 4 Filter selection to orphaned packages.\& .PP .RE .SH FIELDS .PP The field names are all small letters for \fB\-\-match\fR and \fB\-\-fields\fR options and for the machine parseable output (json and yaml).\& For the human readable default format the fields are capitalized.\& .PP The following package metadata fields are available: \fBname\fR, \fBversion\fR, \fBdescription\fR, \fBarch\fR, \fBlicense\fR, \fBorigin\fR, \fBmaintainer\fR, \fBurl\fR, \fBcommit\fR, \fBbuild\-time\fR, \fBinstalled\-size\fR, \fBfile\-size\fR, \fBprovider\-priority\fR, \fBdepends\fR, \fBprovides\fR, \fBreplaces\fR, \fBinstall\-if\fR, \fBlayer\fR, \fBtags\fR, \fBtriggers\fR, \fBscripts\fR, and \fBreplaces\-priority\fR.\& See \fBapk\-package\fR(8) \fBpackage info metadata\fR and \fBpackage metadata\fR sections for the description of these fields.\& .PP Additionally the following fields are available: .PP \fBcontents\fR .RS 4 File names contained in a package.\& .PP .RE \fBdownload\-url\fR .RS 4 Full URL to download the package from.\& .PP .RE \fBowner\fR .RS 4 Lookup owner package for given path name.\& (\fB\-\-match\fR only) .PP .RE \fBpackage\fR .RS 4 The package identifier in format \fBname\fR\-\fBversion\fR (e.\&g.\& package\-1.\&0\-r0).\& .PP .RE \fBrepositories\fR .RS 4 List of repositories the package is available from.\& .PP .RE \fBstatus\fR .RS 4 Status of an installed package.\& List of one or more of following keywords: .PD 0 .IP \(bu 4 \fBinstalled\fR .IP \(bu 4 \fBbroken\-files\fR .IP \(bu 4 \fBbroken\-scripts\fR .IP \(bu 4 \fBbroken\-xattr\fR .PD .PP .RE .SH EXAMPLES .PP # search all packages starting with apk .br apk query "apk*" .PP # show owner package of sensors executable in json .br apk query \-\-format json \-\-match owner /usr/bin/sensors .PP # show apk\-tools and its dependencies in yaml .br apk query \-\-format yaml \-\-recursive apk\-tools .PP # print source packages for all packages providing cmd:apk .br apk query \-\-match name,provides cmd:apk \-\-fields origin .PP # print source packages with specific dependency name .br apk query \-\-match depends so:libapk.\&so.\&2.\&14.\&9 \-\-fields origin