I'm using debian/Ubuntu, and get confused about versions of packages. When using dpkg -l command, I get:

ii  vim                                 2:7.3.429-2ubuntu2.1                Vi IMproved - enhanced vi editor
ii  vim-common                          2:7.3.429-2ubuntu2.1                Vi IMproved - Common files
ii  vim-runtime                         2:7.3.429-2ubuntu2.1                Vi IMproved - Runtime files
ii  vim-tiny                            2:7.3.429-2ubuntu2.1                Vi IMproved - enhanced vi editor - compact version
ii  virt-what                           1.11-1                              detect if we are running in a virtual machine
ii  w3m                                 0.5.3-5ubuntu1                      WWW browsable pager with excellent tables/frames support
ii  watershed                           6                                   reduce superfluous executions of idempotent command
ii  wget                                1.13.4-2ubuntu1                     retrieves files from the web
ii  whiptail                            0.52.11-2ubuntu10                   Displays user-friendly dialog boxes from shell scripts
ii  whoopsie                            0.1.33                              Ubuntu crash database submission daemon
ii  wimlib9                             1.5.0-1~webupd8~precise             Library to extract, create, modify, and mount WIM files
ii  wimtools                            1.5.0-1~webupd8~precise             Tools to extract, create, modify, and mount WIM files
ii  wireless-tools                      30~pre9-5ubuntu2                    Tools for manipulating Linux Wireless Extensions
ii  wpasupplicant                       0.7.3-6ubuntu2.1                    client support for WPA and WPA2 (IEEE 802.11i)
ii  x11-common                          1:7.6+12ubuntu2                     X Window System (X.Org) infrastructure
ii  x11-utils                           7.6+4ubuntu0.1                      X11 utilities
ii  xauth                               1:1.0.6-1                           X authentication utility
ii  xbitmaps                            1.1.1-1                             Base X bitmaps
ii  xclip                               0.12-1                              command line interface to X selections
ii  xfonts-encodings                    1:1.0.4-1ubuntu1                    Encodings for X.Org fonts
ii  xfonts-utils                        1:7.6+1                             X Window System font utility programs
ii  xkb-data                            2.5-1ubuntu1.3                      X Keyboard Extension (XKB) configuration data
ii  xml-core                            0.13                                XML infrastructure and XML catalog file support
rc  xpdf                                3.02-21build1                       Portable Document Format (PDF) reader
ii  xterm                               271-1ubuntu2.1                      X terminal emulator
ii  xz-lzma                             5.1.1alpha+20110809-3               XZ-format compression utilities - compatibility commands
ii  xz-utils                            5.1.1alpha+20110809-3               XZ-format compression utilities
ii  zabbix-agent                        1:1.8.11-1                          network monitoring solution - agent
ii  zlib1g                              1:             compression library - runtime
ii  zlib1g-dev                          1:             compression library - development
ii  zsh                                 4.3.17-1ubuntu1                     shell with lots of features

The third column is version, but it is all "messed up" in a way I can't understand. I mean, different packages use totally different naming specifications.

Here are the major questions:

  1. Why do some version numbers have ubuntu in them, and some not?
  2. What does all the special punctuation -~+ mean?
  3. What are alpha, build, and dfsg? Can I just use them casually?
  4. vim and other packages have 2:. What does that mean?
  5. How does "version comparison" work, when version formats can be so different?

Can anyone please explain this to me? Or where can I find an official document?

Thanks in advance.

  • What do you mean at: "Why there are ubuntu in them, and there are not?" Jul 26, 2015 at 8:23
  • 2
    @CiroSantilli709大抓捕六四事件法轮功 i.e. why do some version numbers have a suffix containing the word ubuntu and some not.
    – rakslice
    May 23, 2017 at 22:34

2 Answers 2


The Debian Policy Manual has this to say about the version field, which answers some parts of your question:


... The format is: [epoch:]upstream_version[-debian_revision]

The three components here are:


This is a single (generally small) unsigned integer. It may be omitted, in which case zero is assumed.

Epochs can help when the upstream version numbering scheme changes, but they must be used with care. You should not change the epoch, even in experimental, without getting consensus on debian-devel first.


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 must contain only alphanumerics [6] and the characters "." (full stop), "+" (plus), "-" (hyphen), "~" (tilde)2 and should start with a digit. If there is no debian_revision then hyphens 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 conventional to restart the debian_revision at 1 each time the upstream_version is increased.

The package management system 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 is equivalent to a debian_revision of 0.

Presence of the debian_revision part indicates this package is a non-native package (see Source packages). Absence indicates the package is a native package.


When comparing two version numbers, first the epoch of each are compared, then the upstream_version if epoch is equal, and then debian_revision if upstream_version is also equal. epoch is compared numerically. The upstream_version and debian_revision parts are compared by the package management system using the following algorithm:

The strings are compared from left to right.

First the initial part of each string consisting entirely of non-digit characters is determined. These two parts (one of which may be empty) are compared lexically. If a difference is found it is returned. The lexical comparison is a comparison of ASCII values modified so that all the letters sort earlier than all the non-letters and so that a tilde sorts before anything, even the end of a part. For example, the following parts are in sorted order from earliest to latest: ~~, ~~a, ~, the empty part, a. [7]

Then the initial part of the remainder of each string which consists entirely of digit characters is determined. The numerical values of these two parts are compared, and any difference found is returned as the result of the comparison. For these purposes an empty string (which can only occur at the end of one or both version strings being compared) counts as zero.

These two steps (comparing and removing initial non-digit strings and initial digit strings) are repeated until a difference is found or both strings are exhausted. Epochs should be used sparingly

Note that the purpose of epochs is to cope with situations where the upstream version numbering scheme changes and to allow us to leave behind serious mistakes. If you think that increasing the epoch is the right solution, you should consult debian-devel and get consensus before doing so (even in experimental).

Epochs should not be used when a package needs to be rolled back. In that case, use the +really convention: for example, if you uploaded 2.3-3 and now you need to go backwards to upstream 2.2, call your reverting upload something like 2.3+really2.2-1. Eventually, when we upload upstream 2.4, the +really part can go away.

Epochs are also 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. [8]

Further, from the Ubuntu Maintainers Handbook:

The ubuntu string then marks that whatever follows it is related to changes added in Ubuntu.

The alpha string doesn't seem to have any particular meaning.

The buildX suffix is used by Ubuntu, e.g. to indicate no change rebuilds.

dfsg refers to a package that has been modified for compliance with the Debian Free Software Guidelines.


  • 2
    Thanks, this helps a lot. But how version comparison works? digits , letters, and ~+, which comes first, and which last?
    – cizixs
    Jun 12, 2014 at 9:01
  • 1
    I've expanded the quote in my answer to include the section of the manual that describes the comparison behaviour.
    – Flup
    Jun 12, 2014 at 9:24
  • 3
    Is there an online tool somewhere where I can test how these version strings get sorted?
    – Nick
    Jun 13, 2017 at 20:54
  • 1
    Could you please paste same examples? For example, parsing some of the versions above into the separate parts. If both the upstream version and the debian version can contain - and + how do we know where the separation is? Also, the first link seems to be broken.
    – fersarr
    Nov 2, 2017 at 14:28
  • 1
    @Nick you can use dpkg --compare-versions: stackoverflow.com/questions/4957514/…
    – iliis
    Jan 19, 2022 at 18:22

XubuntuY part of the version e.g. 1ubuntu1

  • X is the Debian package version. Most Ubuntu packages are based on Debian packages, which is an "upstream" distro.

    If 0, this means that there is no Debian package: it only exists in Ubuntu.

    X resets when the real upstream version is updated, e.g. Binutils 2.25 to Binutils 2.26.

    Debian versions exist because Debian may make patches to the packages so that is will work better in the Debian system or for security releases.

    Debian developers are of course keen on merging patches back to avoid forking.

    Every time a new set patches is made, this number increases.

  • ubuntuY is optional.

    If not present, it means that the Debian package was used directly.

    Otherwise, it means that this is the Yth Ubuntu patch applied on top of a Debian patch, much like Debian applies on top of the real upstream.

    Y resets when X increases.

If you get the source of a package with:

apt-get source gdb

you will see the patches applied by Ubuntu and Debian at:


Even more interesting, you can clone with bzr and see a list of all the Ubuntu versions with what changed between them:

bzr branch ubuntu:gdb
cd gdb
bzr log | less

See also: https://askubuntu.com/questions/620533/what-is-the-meaning-of-the-xubuntuy-string-in-ubuntu-package-names

What the Epoch actually represents


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .