Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Before I install a package I'd like to know what version i would get. How do I check the version before installing using apt-get or aptitude on debian or ubuntu?

share|improve this question
up vote 307 down vote accepted


You can run a simulation to see what would happen if you upgrade/install a package:

apt-get -s install <package>

To see all possible upgrades, run a upgrade in verbose mode and (to be safe) with simulation, press n to cancel:

apt-get -V -s upgrade


The option policy can show the installed and the remote version (install candidate) of a package.

apt-cache policy <package>


If installed, shows version information about one or more packages:

apt-show-versions <package>

Passing the -u switch with or without a package name will only show upgradeable packages.


The console GUI of aptitude can display upgradeable packages with new versions. Open the menu 'Upgradable Packages'. Pressing v on a package will show more detailed version information.

Or on the command-line:

aptitude versions <package>

Passing -V will show detailed information about versions, again to be safe with the simulation switch:

aptitude -V -s install <package>

Substituting install <package> with upgrade will show the versions from all upgradeable packages.

share|improve this answer
"The program 'apt-show-versions' is currently not installed. You can install it by typing.." – Peter Ehrlich Jul 2 '12 at 20:45
apt-get -V -s upgrade made my day, thank you! – dr.dimitru Jan 16 at 14:35
Is it recommended to run apt-get install -s with sudo? – edwinksl Jun 4 at 20:29

Another way using dpkg and grep:

dpkg -s <package> | grep Version
share|improve this answer
This does not work when <package> is not already installed (which was a requirement in the question). – Serrano Pereira May 2 '14 at 9:37

Another option, if you don't know the full name of the package, is formatting aptitude's search output:

aptitude search <package> -F "%c %p %d %V"

%c = status (package installed or not)
%p = package's name
%d = package's description
%V = available package's version

Reference: http://linux.die.net/man/8/aptitude

share|improve this answer
 $ rmadison gdm3
 gdm3 | 2.30.5-6squeeze2 | squeeze-security | i386
 gdm3 | 2.30.5-6squeeze5 | squeeze          | i386
 gdm3 | 3.4.1-8          | wheezy           | i386
 gdm3 | 3.14.1-7         | jessie           | i386
 gdm3 | 3.18.0-2         | stretch          | i386
 gdm3 | 3.18.0-2         | sid              | i386

from devscripts.deb

share|improve this answer
For ubuntu this shows versions found for different ubuntu versions (codenames like "precise", "trusty" and "xenial"). Very slow, but may help you with the decision to upgrade your LTS ;) – Tomasz Gandor May 2 at 14:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.