Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Using APT, you can install a specific version of a package using:

apt-get install package=1.0

But you can't do

apt-get install package=1.*

So, how can I find out which versions are avaliable for package on a specific repository, or in all repositories in my /etc/apt/sources.list?

share|improve this question

3 Answers 3

up vote 17 down vote accepted

Just as an addendum

apt-cache madison package

will list the versions available from all your sources.

apt-cache madison vim
   vim | 2:7.3.547-1 | http://debian.mirrors.tds.net/debian/ unstable/main amd64 Packages
   vim | 2:7.3.429-2 | http://debian.mirrors.tds.net/debian/ testing/main amd64 Packages
   vim | 2:7.3.429-2 | http://http.us.debian.org/debian/ testing/main amd64 Packages
   vim | 2:7.3.429-2 | http://debian.mirrors.tds.net/debian/ testing/main Sources
   vim | 2:7.3.547-1 | http://debian.mirrors.tds.net/debian/ unstable/main Sources
share|improve this answer
    
Madison? Is that a parameter to apt-cache or a package name? I'm not using an apt-get distro anymore (but +1 just in case) –  Camilo Martin Jun 17 '12 at 19:56
3  
parameter. Don't feel bad, it was one of those chance discoveries for me too. There's a web page (app?) on the Debian site which shows the same information, which I suppose was first, and someone coded it for apt-cache. Quite handy. –  lornix Jun 17 '12 at 19:57
    
Wow, quite handy indeed. I'll change the accept to this because it's just what I wanted (at the time) and comes built-in without grepping it. –  Camilo Martin Jun 18 '12 at 21:25
    
This doesn't work for all packages. –  Cerin Feb 22 at 15:32

The apt-cache show <Package> shows the package descriptions of all the versions your debian installation can install (i.e. from cached list of packages available from the repos listed in sources.list). So I guess you could try something like (for e.g.):

# apt-cache show package | grep Version
Version 1.0
Version 0.9-2squeeze1

The apt-cache show would give you much more info than just versions.

share|improve this answer
    
Thanks, will try out. Is it possible to downgrade? –  Camilo Martin Feb 24 '12 at 17:47
    
It seems to work, I just want to know if this would list packages whose versions are lower than what I currently have. –  Camilo Martin Feb 24 '12 at 17:51
    
Nevermind, it does. Thanks! –  Camilo Martin Feb 24 '12 at 18:03
    
You are welcome :) –  Anil Feb 24 '12 at 18:07
4  
you can use apt-cache policy if only the version interest you. –  Rémi Feb 24 '12 at 18:11

A command that is specifically intended for this is apt-show-versions. You often have to install it, but then can run apt-show-versions -a and it will show you the version number, the distribution (i.e. testing, stable, unstable, backports, etc.) where that can be found, and finally tell you if the version you have installed is up to date or not.

It does not give you as much information as apt-cache, but gives you pretty much what you need, as you can then install from the correct repository (using aptitude / apt-get -t) or simply install using the correct version number in the form you noted.

share|improve this answer
    
+1, but while testing it on my girlfriend's box with an arbitrary example, it misses one of the versions that apt-cache picked: i.imgur.com/15be7.png –  Camilo Martin Mar 21 '12 at 9:37
    
That's interesting, it seems to have skipped the oldest one. Perhaps your apt preferences are set to prefer testing? –  ShankarG Mar 21 '12 at 14:14
    
I don't know? Where would I look to check if it prefers testing? –  Camilo Martin Mar 21 '12 at 16:18
    
Check the file /etc/apt/preferences –  ShankarG Mar 22 '12 at 4:35

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.