{
    "mode": "man",
    "parameter": "sort-dctrl",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/sort-dctrl/1/json",
    "generated": "2026-05-30T05:14:24Z",
    "synopsis": "sort-dctrl [options] [ file ...  ]\nsort-dctrl --copying | --help | --version | -ChV",
    "sections": {
        "NAME": {
            "content": "sort-dctrl - sort Debian control files\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sort-dctrl [options] [ file ...  ]\n\nsort-dctrl --copying | --help | --version | -ChV\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The sort-dctrl program sorts Debian control files according to specified criteria.\n\nA  Debian control (dctrl) file is a semistructured single-table database stored in a machine-\nparseable text file.  Such a database consists of a set of records; each record is a  mapping\nfrom  field  names  to field content.  Textually, records are separated by empty lines, while\neach field is encoded as one or more nonempty lines inside a record.  A field starts with its\nname, followed by a colon, followed by the field content.  The colon must reside on the first\nline of the field, and the first line must start with no whitespace.   Subsequent  lines,  in\ncontrast, always start with linear whitespace (one or more space or tab characters).\n\nThe sort-dctrl program recognizes two field types: string fields and version fields.  Version\nfields act also as numeric fields.  String fields are compared according  to  strict  lexico‐\ngraphical  octet-by-octet  comparison, after ignoring any initial whitespace after the colon.\nVersion fields are parsed and compared as Debian version  numbers.   When  comparing  version\nnumbers,  if  a  field content does not in fact conform to the version number syntax, it com‐\npares less than any field content that does conform, and equal  to  any  other  nonconforming\nfield  content.  The sort-dctrl program assumes all fields are string fields unless told oth‐\nerwise.\n\nYou can specify arbitrary number of keys for sorting, using the -k option.  The keys are  in‐\nterpreted  in  a descending order of priority: the first key specified is primary, the second\nkey specified is secondary, and so on.  If two records compare equal under the  primary  key,\nthen  they  are compared under the secondary key, and so on.  If no keys are specified, a de‐\nfault key is assumed (the \"Package\" field with no modifiers).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-k --key-spec=",
                    "content": "Specify one or more keys for sorting.  You may  specify  this  option  any  number  of\ntimes.  The keyspec argument consists of a comma-separated list of key specifications.\nEach key specification consists of the name of the field that serves as the  key,  op‐\ntionally  followed by a colon and key modifiers.  The following key modifiers are sup‐\nported:\n\nr      Invert the comparison for this key, reversing the sorting order.\n\nv      Treat this field as a version number field.\n\nn      Treat this field as numeric, which currently is synonymous with v.\n",
                    "flag": "-k"
                },
                {
                    "name": "-q --quiet --silent",
                    "content": "Output nothing to the standard output stream.  Instead, exit immediately after finding\nthe first match.\n",
                    "flag": "-q",
                    "long": "--silent"
                },
                {
                    "name": "-l --errorlevel=",
                    "content": "Set  log  level  to level.  level is one of fatal, important, informational and debug,\nbut the last may not be available, depending on the compile-time options.  These cate‐\ngories are given here in order; every message that is emitted when fatal is in effect,\nwill be emitted in the important error level, and so on. The default is important.\n",
                    "flag": "-l"
                },
                {
                    "name": "-V --version",
                    "content": "Print out version information.\n",
                    "flag": "-V",
                    "long": "--version"
                },
                {
                    "name": "-C --copying",
                    "content": "Print out the copyright license.  This produces much output; be sure  to  redirect  or\npipe it somewhere (such as your favourite pager).\n",
                    "flag": "-C",
                    "long": "--copying"
                },
                {
                    "name": "-h --help",
                    "content": "Print out a help summary.\n",
                    "flag": "-h",
                    "long": "--help"
                }
            ]
        },
        "EXAMPLES": {
            "content": "Here are some sample invocations of the program:\n\nsort-dctrl /var/lib/dpkg/available\nOutput the dpkg available file sorted by the package name.\n\nsort-dctrl -k Version:v /var/lib/dpkg/available\nOutput the dpkg available file sorted in ascending order of version numbers.\n\nsort-dctrl -k Version:vr /var/lib/dpkg/available\nOutput the dpkg available file sorted in descending order of version numbers.\n\nsort-dctrl -k Package,Version:v /var/lib/dpkg/available\nOutput  the  dpkg  available file sorted primarily in ascending order of package names\nand secondarily in descending order of version numbers.\n\nsort-dctrl -k Installed-Size:n,Size:nr /var/lib/dpkg/available\nOutput the dpkg available file sorted primarily in  ascending  order  of  installation\nsizes and secondarily in descending order of package sizes.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "The program and this manual page were written by Antti-Juhani Kaijanaho <ajk@debian.org>.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Debian  Policy Manual.  Published as the Debian package debian-policy.  Also available in the\nDebian website.\n\ngrep-dctrl(1)\n\n\n\n\n\n\n\nDebian Project                               2005-06-08                                SORT-DCTRL(1)",
            "subsections": []
        }
    },
    "summary": "sort-dctrl - sort Debian control files",
    "flags": [
        {
            "flag": "-k",
            "long": null,
            "arg": null,
            "description": "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, op‐ tionally followed by a colon and key modifiers. The following key modifiers are sup‐ ported: 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 with v."
        },
        {
            "flag": "-q",
            "long": "--silent",
            "arg": null,
            "description": "Output nothing to the standard output stream. Instead, exit immediately after finding the first match."
        },
        {
            "flag": "-l",
            "long": null,
            "arg": null,
            "description": "Set log level to level. level is one of fatal, important, informational and debug, but the last may not be available, depending on the compile-time options. These cate‐ gories are given here in order; every message that is emitted when fatal is in effect, will be emitted in the important error level, and so on. The default is important."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Print out version information."
        },
        {
            "flag": "-C",
            "long": "--copying",
            "arg": null,
            "description": "Print out the copyright license. This produces much output; be sure to redirect or pipe it somewhere (such as your favourite pager)."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Print out a help summary."
        }
    ],
    "examples": [
        "Here are some sample invocations of the program:",
        "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."
    ],
    "see_also": [
        {
            "name": "grep-dctrl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/grep-dctrl/1/json"
        },
        {
            "name": "SORT-DCTRL",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/SORT-DCTRL/1/json"
        }
    ]
}