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.

I want to see the version of a package before I install it. How can I do this?

share|improve this question
add comment

5 Answers 5

up vote 11 down vote accepted

Packages known by your system / offline

You can use apt-cache to query the APT cache. To show the versions known by your system use apt-cache policy. Example:

apt-cache policy iceweasel  
iceweasel:                        
  Installed: 10.0.4esr-3
  Candidate: 10.0.4esr-3
  Version table:
     12.0-7 0
          1 http://ftp.us.debian.org/debian/ experimental/main amd64 Packages
 *** 10.0.4esr-3 0
        500 http://ftp.us.debian.org/debian/ sid/main amd64 Packages
        100 /var/lib/dpkg/status
     10.0.4esr-2 0
        500 http://ftp.us.debian.org/debian/ testing/main amd64 Packages

This means iceweasel version 12.0-7 is available in experimental and has priority 1, version 10.0.4esr-3 is installed from sid and has priority 500 and 10.0.4esr-2 is in testing.

For a detailed description about the meaning of priorities have a look at apt_preferences(5)

You can also display a brief description and some meta information about the package with

apt-cache show package-name

Information about all debian packages / online

If you want to get version information about all available debian packages (basically what http://packages.debian.org does) you can use rmadison(1) to remotely query the database. rmadison is in the devscripts package which you have to install via apt-get install devscripts.

$ rmadison iceweasel
 iceweasel | 3.0.6-3             | lenny-security    | source, alpha, amd64, arm, armel, hppa, i386, ia64, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.0.6-3             | lenny             | source, alpha, amd64, arm, armel, hppa, i386, ia64, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.5.16-11~bpo50+1   | backports/lenny   | source, alpha, amd64, armel, i386, ia64, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.5.16-14           | squeeze           | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.5.16-15           | squeeze-p-u       | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.5.16-15           | squeeze-security  | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc
 iceweasel | 10.0.4esr-2~bpo60+1 | squeeze-backports | source, amd64, i386, kfreebsd-amd64, kfreebsd-i386, s390
 iceweasel | 10.0.4esr-2         | wheezy            | source, amd64, armel, armhf, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, s390x, sparc
 iceweasel | 10.0.4esr-3         | sid               | source, amd64, armel, armhf, hurd-i386, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, s390x, sparc
 iceweasel | 11.0-4              | experimental      | source, armel
 iceweasel | 12.0-3              | experimental      | source, mips
 iceweasel | 12.0-7              | experimental      | source, amd64, armhf, hurd-i386, i386, ia64, kfreebsd-amd64, kfreebsd-i386, powerpc, s390, s390x, sparc

The difference between apt-cache and rmadison is that apt-cache shows only the information known to your system (but can be used offline) while rmadison shows all version of available packages

share|improve this answer
    
Why you choice apt-cache policy for see package information? What is the cause of you choice apt-cache instead of aptitude? –  mesuutt May 24 '12 at 13:20
1  
@mesuutt aptitude show shows only one version/the version installed. But as i have multiple repositories in my sources.list (testing, unstable, experimental) i want to know which version is available in which package. You can also have a look at apt-cache show which is basically like aptitude show but will show the information for multiple versions. –  Ulrich Dangel May 24 '12 at 13:24
    
Thanks @UlrichDangel.I did not work with multiple package version and repository more.Now I think that apt-cache policy is more useful if you work with multiple repository :) –  mesuutt May 24 '12 at 13:47
    
@UlrichDangel aptitude can show versions for multiple repositories since squeeze. –  rush May 24 '12 at 13:57
    
@mesuutt rush is right you can see multiple versions either via aptitude show -v $PACKAGE or the answer he posted –  Ulrich Dangel May 24 '12 at 14:06
add comment

In addition to other answers, in case you have a .deb package file, you can do

$ dpkg-deb -I package.deb

to see control information (name, description, version, dependencies...) andbasic stats like size or

$ dpkg-deb -f package.deb Version

to print only version.

Examples:

  • full info (note that first 4 lines are beyond typical control info)

    me@here:~$ dpkg-deb -I in/sw/minutor_2.0_amd64.deb 
     new debian package, version 2.0.
     size 131594 bytes: control archive=682 bytes.
         534 bytes,    12 lines      control              
         386 bytes,     6 lines      md5sums              
     Package: minutor
     Version: 2.0
     Architecture: amd64
     Maintainer: Sean Kasun <REDACTED>
     Installed-Size: 340
     Depends: libc6 (>= 2.14), libgcc1 (>= 1:4.1.1), libqt5core5
    (>= 5.0.1+dfsg), libqt5gui5 (>= 5.0.1+dfsg), libqt5network5
    (>= 5.0.1+dfsg), libqt5widgets5 (>= 5.0.1+dfsg), libstdc++6
    (>= 4.1.1), zlib1g (>= 1:1.1.4)
     Section: utils
     Priority: extra
     Homepage: http://seancode.com/minutor/
     Description: Minecraft mapping tool
      Minutor lets you view and inspect your Minecraft worlds.
      It is designed for Minecraft 1.2 and later.
    me@here:~$
    
  • version only

    me@here:~$ dpkg-deb -f in/sw/minutor_2.0_amd64.deb Version
    2.0
    me@here:~$ 
    
share|improve this answer
add comment

I personnaly find apt-cache madison useful, as it shows in a parser-friendly form what version is available with each release :

apt-cache madison iceweasel | grep 'Packages$'
 iceweasel |     21.0-1 | http://ftp.fr.debian.org/debian/ rc-buggy/main amd64 Packages
 iceweasel | 17.0.6esr-1 | http://ftp.fr.debian.org/debian/ sid/main amd64 Packages
 iceweasel | 10.0.12esr-1+nmu1 | http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
 iceweasel | 10.0.12esr-1 | http://ftp.fr.debian.org/debian/ wheezy/main amd64 Packages
share|improve this answer
add comment

aptitude since squeeze has ability to show all available versions. This is very useful in case you have repositories for different releases:

 $ aptitude versions aptitude
i   0.6.3-3.2+squeeze1        stable               700
p   0.6.7-1                   testing,unstable     650
share|improve this answer
    
Ah this looks great. There is just some small/minor gripe i discovered. aptitude versions seems to treat the package name as a pattern, this means something like aptitude versions gcc list many other packets besides the gcc package. –  Ulrich Dangel May 24 '12 at 14:09
    
Hm, that's strange. At my side aptitude versions doesn't treat name as pattern and aptitude versions gcc show versions only for gcc package and it shows nothing about gcc-4.1 and others. May be it is as you describe in testing or even sid, unfortunately I don't have access to such versions right now to confirm that. –  rush May 24 '12 at 14:16
add comment

Lots of package information is found at http://packages.debian.org/package-name, e.g. http://packages.debian.org/iceweasel.

But aptitude can help, too, try

aptitude show package-name
share|improve this answer
    
Thanks.This is good ;) –  mesuutt May 24 '12 at 12:56
add comment

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.