How to find the version of the Dash shell on Ubuntu /bin?

There are plenty of ways:

  • apt-cache policy

    Run the following command:

    apt-cache policy dash
    

    On my machine the output is:

    dash:
    Installed: 0.5.7-3ubuntu1
    Candidate: 0.5.7-3ubuntu1
    Version table:
    *** 0.5.7-3ubuntu1 0
        500 http://in.archive.ubuntu.com/ubuntu/ quantal/main amd64 Packages
        100 /var/lib/dpkg/status
    

    The version of dash, therefore, installed on my system is 0.5.7.

  • dpkg -s

    Run the following command:

    dpkg -s dash
    

    The output on my machine is:

    Package: dash
    Essential: yes
    Status: install ok installed
    Priority: required
    Section: shells
    Installed-Size: 213
    Maintainer: Ubuntu Developers 
    Architecture: amd64
    Version: 0.5.7-3ubuntu1
    Depends: debianutils (>= 2.15), dpkg (>= 1.15.0)
    Pre-Depends: libc6 (>= 2.14)
    Description: POSIX-compliant shell
    The Debian Almquist Shell (dash) is a POSIX-compliant shell derived
    from ash.
    .
    Since it executes scripts faster than bash, and has fewer library
    dependencies (making it more robust against software or hardware
    failures), it is used as the default system shell on Debian systems.
    Homepage: http://gondor.apana.org.au/~herbert/dash/
    Original-Maintainer: Gerrit Pape 
    

    As you can see, the version is: 0.5.7.


Understanding Versioning Conventions

The versioning in Ubuntu is of the form:

<upstream_version>-<debian_revision>ubuntu<ubuntu_revision>

Here:

  • <upstream_version>: is the version of the original package

    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.

  • <debian_revision>: is the debian version of the package.

    This part of the version number specifies the version of the Debian package based on the upstream version.

    If <debian_revision> = 0, then this means that there is no debian package (or that the ubuntu team has forked a debian package to a newer version than the one found in the debian repositories).

  • ubuntu: just the keyword ubuntu.

  • <ubuntu_revision>: is the ubuntu version of the package.

    • If this is missing this mean that it is a clean, unchanged debian package.
    • If this is present it means that Ubuntu has taken the debian package and released it with some additional patches or bug fixes.

Let's take an example.

  • 2.6.0-1ubuntu1

    Here,

    • Upstream Package Version: 2.6.0
    • Debian Revision: 1
    • Ubuntu Revision: 1
  • 2.6.0-0ubuntu1

    Here,

    • Upstream Package Version: 2.6.0
    • Debian Revision: 0 (which means no revisions)
    • Ubuntu Revision: 1

Sources and Further Information:

  • Debian Versioning: http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version

  • Ubuntu Package Versioning Explanation: http://www.ducea.com/2006/06/17/ubuntu-package-version-naming-explanation/