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:

  1. each query string is executed independently to select candidate packages
  2. if --all-matches is not specified, the best candidate for the given term gets added to the list of result packages
  3. 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 are name, package or origin. πŸŽ€
  • --format FORMATSPEC β€” set the output format: default, yaml or json. 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) or none (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, and reverse-install-if.
  • --upgradable β€” filter the selection to upgradable packages.
  • --world β€” include apk-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. --match only, iykyk. ⚠️
  • package β€” the package identifier in the format name-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:
    • installed
    • broken-files
    • broken-scripts
    • broken-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