deb-version — Debian package version number format
[epoch:]upstream-version[-debian-revision]
| Use Case | Command | Description |
|---|---|---|
| 🔍 View package versions | dpkg -l | grep <package> | List installed packages and their versions |
| ⚖️ Compare two versions | dpkg --compare-versions <ver1> <ver2> | Compare version strings using dpkg's algorithm |
| 🧩 Parse version string | dpkg --compare-versions "1:2.3.4-5" > "1:2.3.3-1" | Epoch, upstream-version, debian-revision parsing |
| 📦 Check version ordering | dpkg --compare-versions "1.0~rc1" < "1.0" | Tilde sorts before anything, even empty string |
Version numbers as used for Debian binary and source packages consist of three components. These are:
This is a single (generally small) unsigned integer. It may be omitted, in which case zero is assumed. If it is omitted then the upstream-version may not contain any colons.
It is provided to allow mistakes in the version numbers of older versions of a package, and also a package's previous version numbering schemes, to be left behind.
This is the main part of the version number. It is usually the version number of the original (“upstream”) package from which the .deb file has been made, if this is applicable. Usually this will be in the same format as that specified by the upstream author(s); however, it may need to be reformatted to fit into the package management system's format and comparison scheme.
The comparison behavior of the package management system with respect to the upstream-version is described below. The upstream-version portion of the version number is mandatory.
The upstream-version may contain only alphanumerics (“A-Za-z0-9”) and the characters . + - : ~ (full stop, plus, hyphen, colon, tilde) and should start with a digit. If there is no debian-revision then hyphens are not allowed; if there is no epoch then colons are not allowed.
This part of the version number specifies the version of the Debian package based on the upstream version. It may contain only alphanumerics and the characters + . ~ (plus, full stop, tilde) and is compared in the same way as the upstream-version is.
It is optional; if it isn't present then the upstream-version may not contain a hyphen. This format represents the case where a piece of software was written specifically to be turned into a Debian package, and so there is only one “debianization” of it and therefore no revision indication is required.
It is conventional to restart the debian-revision at ‘1’ each time the upstream-version is increased.
Dpkg will break the version number apart at the last hyphen in the string (if there is one) to determine the upstream-version and debian-revision. The absence of a debian-revision compares earlier than the presence of one (but note that the debian-revision is the least significant part of the version number).
The upstream-version and debian-revision parts are compared by the package management system using the same algorithm:
The strings are compared from left to right.
Note that the purpose of epochs is to allow us to leave behind mistakes in version numbering, and to cope with situations where the version numbering scheme changes. It is not intended to cope with version numbers containing strings of letters which the package management system cannot interpret (such as ‘ALPHA’ or ‘pre-’), or with silly orderings.
The tilde character and its special sorting properties were introduced in dpkg 1.10 and some parts of the dpkg build scripts only gained support for it later in the 1.10.x series.
Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-30 22:25 @216.73.217.135
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)