List all versions of a package

Solution 1:

You have the correct command, except linux-image isn't a real package name.

$ apt-cache show linux-image
N: Can't select versions from package 'linux-image' as it is purely virtual
N: No package found

apt-cache showpkg should work for real packages, though. e.g.

$ apt-cache showpkg lyx
Package: lyx
Versions: 
2.1.0-1~trusty~ppa4 (/var/lib/apt/lists/ppa.launchpad.net_lyx-devel_release_ubuntu_dists_trusty_main_binary-amd64_Packages) (/var/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/apt/lists/ppa.launchpad.net_lyx-devel_release_ubuntu_dists_trusty_main_binary-amd64_Packages
                  MD5: 8c75d53cfd29c5b19c2172cb07b7fe9a

2.0.6-1build1 (/var/lib/apt/lists/ftp.iinet.net.au_pub_ubuntu_dists_trusty_universe_binary-amd64_Packages)

If you want to see all the versions of linux-image-like packages, you can just do a search, e.g.

$ apt-cache search linux-image | grep '^linux-image'

The problem is that the different versions of the kernel (linux-image) are in individual packages, and named independently according to the version. They are not all versions of the one package.


EDIT

This lists all available packages. To show which is installed, you can use dpkg -l. e.g.

$ dpkg -l lyx
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                           Version                      Architecture                 Description
+++-==============================================-============================-============================-==================================================================================================
ii  lyx                                            2.1.0-1~trusty~ppa4          amd64                        Document Processor

EDIT2

Another way to get information about different but similarly-named packages (e.g. linux-image*) is by using aptitude search.

$ aptitude search linux-image

You can also filter with grep using this awkward syntax to get around an aptitude bug/feature.

$ aptitude -w $COLUMNS search linux-image | grep '32 bit'

An i in the first column tells you that it's already installed. See man aptitude for the other characters.

Solution 2:

I think you're looking for the madison command in apt-cache:

apt-cache madison chromium-browser

Output:

chromium-browser | 50.0.2661.102-0ubuntu0.14.04.1.1117 | http://archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
chromium-browser | 50.0.2661.102-0ubuntu0.14.04.1.1117 | http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
chromium-browser | 34.0.1847.116-0ubuntu2 | http://archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

Shows a quick reference of all available versions and the repo they come from. This is great if you use a PPA for a package and want to check the difference in versions between the PPA and the main repos.

More info on madison from the man page:

madison pkg...
           apt-cache's madison command attempts to mimic the output format and a subset of the functionality of the Debian archive management tool,
           madison. It displays available versions of a package in a tabular format. Unlike the original madison, it can only display information
           for the architecture for which APT has retrieved package lists (APT::Architecture).