SORT-DCTRL(1)
π SORT-DCTRL(1) π
okay bestie, welcome to the Debian user's manual page for sort-dctrl, and honestly? she's iconic. let's get into it π
β¨ NAME β¨
sort-dctrl β sorts Debian control files. yes that's the whole job and she does it flawlessly π
πΈ SYNOPSIS πΈ
sort-dctrl [options] [ file ... ]
sort-dctrl --copying | --help | --version | -ChV
π¦ DESCRIPTION π¦
so basically, the sort-dctrl program sorts Debian control files according to criteria you specify. that's the vibe. π
a Debian control (dctrl) file is a semistructured single-table database stored in a machine-parseable text file. think of it like a cute little database that lives in a text file, no cap. such a database consists of a set of records; each record is a mapping from field names to field content. textually, records are separated by empty lines, while each field is encoded as one or more nonempty lines inside a record. a field starts with its name, followed by a colon, followed by the field content. the colon must reside on the first line of the field, and the first line must start with no whitespace. subsequent lines, in contrast, always start with linear whitespace (one or more space or tab characters). periodt.
the sort-dctrl program recognizes two field types: string fields and version fields. version fields act also as numeric fields. string fields are compared according to strict lexicographical octet-by-octet comparison, after ignoring any initial whitespace after the colon. version fields are parsed and compared as Debian version numbers. when comparing version numbers, if a field content does not in fact conform to the version number syntax, it compares less than any field content that does conform, and equal to any other nonconforming field content. the sort-dctrl program assumes all fields are string fields unless told otherwise. π
you can specify arbitrary number of keys for sorting, using the -k option. the keys are interpreted in a descending order of priority: the first key specified is primary, the second key specified is secondary, and so on. if two records compare equal under the primary key, then they are compared under the secondary key, and so on. if no keys are specified, a default key is assumed (the "Package" field with no modifiers). she's got defaults, she's got range π
π OPTIONS π
-kkeyspec,--key-spec=keyspec β specify one or more keys for sorting. you may specify this option any number of times. the keyspec argument consists of a comma-separated list of key specifications. each key specification consists of the name of the field that serves as the key, optionally followed by a colon and key modifiers. the following key modifiers are supported:rβ invert the comparison for this key, reversing the sorting order.vβ treat this field as a version number field.nβ treat this field as numeric, which currently is synonymous withv.
-q,--quiet,--silentβ output nothing to the standard output stream. instead, exit immediately after finding the first match. she's shy, she's efficient π«Ά-llevel,--errorlevel=level β set log level to level. level is one offatal,important,informationalanddebug, but the last may not be available, depending on the compile-time options. these categories are given here in order; every message that is emitted whenfatalis in effect, will be emitted in theimportanterror level, and so on. the default isimportant.-V,--versionβ print out version information. β-C,--copyingβ print out the copyright license. this produces much output; be sure to redirect or pipe it somewhere (such as your favourite pager). seriously bestie, don't just let it loose on your terminal π-h,--helpβ print out a help summary. π
π₯ EXAMPLES π₯
here are some sample invocations of the program, and they all ate:
sort-dctrl /var/lib/dpkg/availableβ output the dpkg available file sorted by the package name.sort-dctrl -k Version:v /var/lib/dpkg/availableβ output the dpkg available file sorted in ascending order of version numbers.sort-dctrl -k Version:vr /var/lib/dpkg/availableβ output the dpkg available file sorted in descending order of version numbers.sort-dctrl -k Package,Version:v /var/lib/dpkg/availableβ output the dpkg available file sorted primarily in ascending order of package names and secondarily in descending order of version numbers.sort-dctrl -k Installed-Size:n,Size:nr /var/lib/dpkg/availableβ output the dpkg available file sorted primarily in ascending order of installation sizes and secondarily in descending order of package sizes.
π AUTHOR π
the program and this manual page were written by Antti-Juhani Kaijanaho <ajk@debian.org>. absolute legend behavior π
π SEE ALSO π
Debian Policy Manual. published as the Debian package debian-policy. also available in the Debian website.
grep-dctrl(1) β her sister, equally slay π
and that's the whole page bestie!! this one came from the Debian Project and it's dated 2005-06-08, so she's an elder icon but she still serves β¨ mwah, go sort something π
π¦ where this page comes from
- debian bookworm: dctrl-tools 2.24-3+b1 Β· GPL-2.0-or-later
- debian trixie: dctrl-tools 2.24-3+b1 Β· GPL-2.0-or-later
- ubuntu jammy: dctrl-tools 2.24-3build2 Β· GPL-2.0-or-later
- ubuntu noble: dctrl-tools 2.24-3build3 Β· GPL-2.0-or-later
- ubuntu resolute: dctrl-tools 2.24-3build4 Β· GPL-2.0-or-later
- ubuntu stonking: dctrl-tools 2.24-3build4 Β· GPL-2.0-or-later
- Copyright (C) 2005 Antti-Juhani Kaijanaho <gaia@iki.fi>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms