Life In The Stack Trace...

TODO: <Insert clever marketing phrase here>

Using apt-cache to determine package version prior to install


Ever want to know the version of a package that you are about to install prior to installing it? I found two different ways to accomplish this task.

  • apt-cache policy
  • apt-cache show

The policy option is a lot less verbose that the show option. For example, let's say we would like to install the minidlna package from the repositories and would like to know the version that would be installed first.

The following command:

apt-cache show minidlna

# output from the above command
Package: minidlna
Priority: optional
Section: universe/net
Installed-Size: 361
Maintainer: Ubuntu Developers <>
Original-Maintainer: BenoƮt Knecht <>
Architecture: amd64
Version: 1.0.24+dfsg-1
Depends: adduser, lsb-base, libavformat53 (>= 4:0.8-1~) | libavformat-extra-53 (>= 4:0.8-1~), libavutil51 (>= 4:0.8-1~) | libavutil-extra-51 (>= 4:0.8-1~), libc6 (>= 2.15), libexif12, libflac8 (>= 1.2.1), libid3tag0 (>= 0.15.1b), libjpeg8 (>= 8c), libogg0 (>= 1.0rc3), libsqlite3-0 (>= 3.5.9), libvorbis0a (>= 1.1.2)
Filename: pool/universe/m/minidlna/minidlna_1.0.24+dfsg-1_amd64.deb
Size: 148602
MD5sum: 574fb3094c4d7fda5daf861327bec369
SHA1: e2eaf96aeb1044dce176800752d43b357f1a5266
SHA256: a1a25301bf61eb5c2c2d6183df72a94f137b728959aaf448e1657b85827e25d8
Description-en: lightweight DLNA/UPnP-AV server targeted at embedded systems
 MiniDLNA (aka ReadyDLNA) is server software with the aim of being
 fully compliant with DLNA/UPnP-AV clients.
 The minidlna daemon serves media files (music, pictures, and video)
 to clients on your network.  Example clients include applications
 such as totem and xbmc, and devices such as portable media players,
 smartphones, and televisions.
 MiniDLNA is a simple, lightweight alternative to mediatomb, but has
 fewer features. It does not have a web interface for administration
 and must be configured by editing a text file.
Description-md5: 5b2d396f86d25a79b5ab8a1c34181623
Origin: Ubuntu

You can see the version information:

Version: 1.0.24+dfsg-1

The policy option is a lot less verbose.

apt-cache policy minidlna

# output from the above command
  Installed: (none)
  Candidate: 1.0.24+dfsg-1
  Version table:
     1.0.24+dfsg-1 0
        500 quantal/universe amd64 Packages

You can see that there is a lot less information to weed through in order to find the version. Usually, I prefer the quickest, so, the policy option would win this race.