Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

5 Answers 5

up vote 243 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

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


share|improve this answer

After running an update/upgrade you can always use, for instance :-

$ apt-cache policy gdm3
  Installed: (none)
  Candidate: 3.14.2-2
  Version table:
     3.18.0-2 100
        100 unstable/main amd64 Packages
     3.14.2-2 990
        990 testing/main amd64 Packages

Now while the above is a bit different than your case as I have also used priority to keep unstable and experimental out but it would be something similar to this.

Even apt-show-versions -u is good enough for what you want as well.

share|improve this answer
The top/accepted answer mentions both apt-cache policy and apt-show-versions -u. – Faheem Mitha Oct 12 at 20:36
 $ 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

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.