Take the 2-minute tour ×
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

3 Answers 3

up vote 145 down vote accepted

apt-get

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

apt-cache

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

apt-cache policy <package>

apt-show-versions

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.

aptitude

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
3  
"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 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

Your Answer

 
discard

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.