apk-query(8)
π apk-query β the manual, but make it make sense
okay so bestie, welcome to apk-query(8) from the System Manager's Manual. this is the page where apk query gets to be the main character: it goes looking for packages for you, by basically any criteria you want. she's a search engine and she's serving. πβ¨
πΈ NAME πΈ
apk query β query information about packages by various criteria. yes, that's the whole job and she does it gorgeously.
π¦ SYNOPSIS π¦
apk query [<options>...] query...
apk query [<options>...] --recursive constraints...
two whole modes, both iconic, both yours to use.
π DESCRIPTION π
apk query searches for matching packages from selected sources. that's it, that's the vibe.
in the default mode, the query specifiers get read like this:
name{[<>~=]version}β select packages by name, plus an optional version match if you're feeling specific. the<>~=are the little matchy operators, okay, they matter, respect them.textβ select packages by the selected fields matching text. so like, a vibe check on whatever fields you told it to look at.
in --recursive mode, the constraints are a list of dependencies to satisfy, and the solver algorithm does its thing to figure out a list of packages that fulfil those constraints. she's doing math. she's slaying. π§ π
the query executes in these steps, in this exact order, no skipping:
- each query string is executed independently to select candidate packages
- if
--all-matchesis not specified, the best candidate for the given term gets added to the list of result packages - the resulting package list is sorted
periodt. that's the pipeline.
β¨ QUERY OPTIONS β¨
the applets that support query specifiers recognize all of these β every single one, no gatekeeping:
--all-matchesβ select all matched packages. by default only the best match for each query element gets selected, which is lowkey stingy of her but fine.--availableβ filter the selection down to available packages.--fields FIELDS[:REVERSE_FIELD]β a comma separated list of fields to include in the output. you can also optionally say which field to output for the synthetic reverse dependency fields, and your choices there arename,packageororigin. π--format FORMATSPECβ set the output format:default,yamlorjson. the default format is human readable text output, i.e. the one your eyeballs can actually parse.--from FROMSPECβ search packages from:system(all system sources),repositories(exclude installed database),installed(exclude normal repositories) ornone(command-line repositories only). pick your source, bestie.--installedβ filter the selection to installed packages.--match FIELDSβ a comma separated list of fields to match the query against.--recursiveβ run the solver algorithm with the given constraints to select packages. this is the big brain one.--summarize FIELD[:REVERSE_FIELD]β produce a summary of the specified field from all matches. summaries are available on these fields:package,name,origin,depends,provides,replaces,install_if,recommends,reverse-depends, andreverse-install-if.--upgradableβ filter the selection to upgradable packages.--worldβ includeapk-world(5)dependencies in the constraints. this one implies--recursive, so don't act surprised.--orphanedβ filter the selection to orphaned packages. π₯Ί
π FIELDS π
okay so field-name lore: for --match and --fields options β and for the machine parseable output (json and yaml) β all the field names are all small letters. but for the human readable default format, the fields are capitalized. consistency? never met her. π
here's the package metadata field lineup: name, version, description, arch, license, origin, maintainer, url, commit, build-time, installed-size, file-size, provider-priority, depends, provides, replaces, install-if, layer, tags, triggers, scripts, and replaces-priority. for what all of those actually mean, go peek at the package info metadata and package metadata sections of apk-package(8) β she explains it, not me.
and additionally, these extra fields exist:
contentsβ file names contained in a package.download-urlβ the full URL to download the package from.ownerβ look up the owner package for a given path name.--matchonly, iykyk. β οΈpackageβ the package identifier in the formatname-version(e.g.package-1.0-r0).repositoriesβ list of repositories the package is available from.statusβ status of an installed package. it's a list of one or more of these keywords:installedbroken-filesbroken-scriptsbroken-xattr
π₯ EXAMPLES π₯
these are the actual examples, copied with love, run them bestie:
# search all packages starting with apk
apk query "apk*"
# show owner package of sensors executable in json
apk query --format json --match owner /usr/bin/sensors
# show apk-tools and its dependencies in yaml
apk query --format yaml --recursive apk-tools
# print source packages for all packages providing cmd:apk
apk query --match name,provides cmd:apk --fields origin
# print source packages with specific dependency name
apk query --match depends so:libapk.so.2.14.9 --fields origin
π«Ά sign-off π«Ά
that's the whole page, bestie, you ate. this lil beauty comes to you from the System Manager's Manual, dated 2026-11-02, and she's filed under apk-query(8) forever and ever. go query something iconic. ππ
π¦ where this page comes from
- arch rolling: apk-tools 3.0.9-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms