{
    "mode": "man",
    "parameter": "deb-version",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/deb-version/7/json",
    "generated": "2026-08-26T07:09:35Z",
    "synopsis": "[epoch:]upstream-version[-debian-revision]",
    "sections": {
        "NAME": {
            "content": "deb-version - Debian package version number format\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "[epoch:]upstream-version[-debian-revision]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Version numbers as used for Debian binary and source packages consist of three components.\nThese are:\n\nepoch\nThis  is  a  single (generally small) unsigned integer.  It may be omitted, in which case\nzero is assumed.  If it is omitted then the upstream-version may not contain any colons.\n\nIt is provided to allow mistakes in the version numbers of older versions of  a  package,\nand also a package's previous version numbering schemes, to be left behind.\n\nupstream-version\nThis  is  the  main  part of the version number.  It is usually the version number of the\noriginal (“upstream”) package from which  the  .deb  file  has  been  made,  if  this  is\napplicable.   Usually  this  will be in the same format as that specified by the upstream\nauthor(s); however, it may need to be reformatted to  fit  into  the  package  management\nsystem's format and comparison scheme.\n\nThe  comparison  behavior  of the package management system with respect to the upstream-\nversion is described below.  The  upstream-version  portion  of  the  version  number  is\nmandatory.\n\nThe  upstream-version may contain only alphanumerics (“A-Za-z0-9”) and the characters . +\n- : ~ (full stop, plus, hyphen, colon, tilde) and should start with a digit.  If there is\nno debian-revision then hyphens are not allowed; if there is no epoch then colons are not\nallowed.\n\ndebian-revision\nThis part of the version number specifies the version of the Debian package based on  the\nupstream version.  It may contain only alphanumerics and the characters + . ~ (plus, full\nstop, tilde) and is compared in the same way as the upstream-version is.\n\nIt  is  optional; if it isn't present then the upstream-version may not contain a hyphen.\nThis format represents the case where a piece of software was written specifically to  be\nturned  into  a  Debian  package,  and  so  there  is  only one “debianization” of it and\ntherefore no revision indication is required.\n\nIt is conventional to restart the debian-revision at ‘1’ each time  the  upstream-version\nis increased.\n\nDpkg  will  break  the version number apart at the last hyphen in the string (if there is\none) to determine the upstream-version and debian-revision.  The  absence  of  a  debian-\nrevision  compares earlier than the presence of one (but note that the debian-revision is\nthe least significant part of the version number).\n",
            "subsections": [
                {
                    "name": "Sorting algorithm",
                    "content": "The upstream-version and debian-revision parts are compared by the package management  system\nusing the same algorithm:\n\nThe strings are compared from left to right.\n\nFirst  the  initial  part  of  each  string  consisting  entirely  of non-digit characters is\ndetermined.  These two parts (one of which may  be  empty)  are  compared  lexically.   If  a\ndifference  is  found it is returned.  The lexical comparison is a comparison of ASCII values\nmodified so that all the letters sort earlier than all the non-letters and so  that  a  tilde\nsorts  before  anything,  even  the  end  of a part.  For example, the following parts are in\nsorted order: ‘~~’, ‘~~a’, ‘~’, the empty part, ‘a’.\n\nThen the initial part of the remainder of  each  string  which  consists  entirely  of  digit\ncharacters  is  determined.   The  numerical  values of these two parts are compared, and any\ndifference found is returned as the result of the comparison.  For these  purposes  an  empty\nstring (which can only occur at the end of one or both version strings being compared) counts\nas zero.\n\nThese  two steps (comparing and removing initial non-digit strings and initial digit strings)\nare repeated until a difference is found or both strings are exhausted.\n\nNote that the purpose of epochs is to allow us to leave behind mistakes in version numbering,\nand to cope with situations where the version numbering scheme changes.  It is  not  intended\nto  cope  with  version  numbers  containing  strings of letters which the package management\nsystem cannot interpret (such as ‘ALPHA’ or ‘pre-’), or with silly orderings.\n"
                }
            ]
        },
        "NOTES": {
            "content": "The tilde character and its special sorting properties were introduced in dpkg 1.10 and  some\nparts of the dpkg build scripts only gained support for it later in the 1.10.x series.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "deb-control(5), deb(5), dpkg(1)\n\n1.22.6                                       2026-05-06                               deb-version(7)",
            "subsections": []
        }
    },
    "summary": "deb-version - Debian package version number format",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "deb-control",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/deb-control/5/json"
        },
        {
            "name": "deb",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/deb/5/json"
        },
        {
            "name": "dpkg",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/dpkg/1/json"
        }
    ]
}