How to see package version without install?

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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…) and basic 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)
    <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e08d85a088859285">[email protected]</a>:~$ 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.
    <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="056860456d607760">[email protected]</a>:~$
  • version only
    <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="630e06230b061106">[email protected]</a>:~$ dpkg-deb -f in/sw/minutor_2.0_amd64.deb Version
    2.0
    <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8d5ddf8d0ddcadd">[email protected]</a>:~$

Method 2

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

Method 3

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

Method 4

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

Method 5

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x