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?



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.

  • 9
    "The program 'apt-show-versions' is currently not installed. You can install it by typing.." – Peter Ehrlich Jul 2 '12 at 20:45
  • 1
    apt-get -V -s upgrade made my day, thank you! – dr.dimitru Jan 16 '16 at 14:35
  • Is it recommended to run apt-get install -s with sudo? – edwinksl Jun 4 '16 at 20:29
  • @edwinksl: It works fine without it, so I wouldn't expect that sudo would be better. – zondo Jan 9 '17 at 4:28
  • 3
    apt show <packages> can also be added to the list – leo Feb 12 '17 at 21:24

Another way using dpkg and grep:

dpkg -s <package> | grep Version
  • 13
    This does not work when <package> is not already installed (which was a requirement in the question). – Serrano May 2 '14 at 9:37
  • 1
    Serrano Pereira, that answer has helped me, who had a slight different question, but similar enough not to dupe on stackoverflow. – Jose Alban Sep 17 '16 at 13:55
  • better: dpkg -s <package> | grep Version (Note the capital V) – stackoverflowwww Aug 9 '18 at 11:05

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


To obtain package name:

apt-cache search *search term*

To get version details:

apt-cache show *packagename*

I believe apt-get and apt-cache are being deprecated, with apt and aptitude becoming the preferred method. Given the longevity of the apt- suite, it's probably a safe bet for some time to come!

  • That is exactly what I was looking for. Uses remote repo to get version and all sorts of other info. – four43 Aug 24 '17 at 3:50
 $ 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

  • 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 '16 at 14:02

You can write apt show <package>

  • This was already covered in Ned Flanders' answer, unix.stackexchange.com/a/362794/22812 – Anthony Geoghegan Apr 27 '18 at 11:22
  • @yurij you should have wirtten your own answer according the amount of edit you made – Kiwy Apr 27 '18 at 13:11
  • @AnthonyGeoghegan you wrong he talks about apt-cache I'm using apt are two different things... What am I missing? – elvis.dukaj Apr 27 '18 at 14:59
  • apt and apt-cache do the same thing. If you check the source code, they are both front-ends to the same functionality: for show, a function called ShowPackage and for search, a function called DoSearch. – Anthony Geoghegan Apr 27 '18 at 20:45

To see the latest available package before installing. Perform update so that you have all the latest package update.

$sudo apt-get update

Now, To check the latest package available in your repository before installing run below command.

$apt-cache show <package name>


$apt-cache show latexila


$apt-cache show npm

protected by Stephen Kitt Jun 14 '18 at 16:34

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?