Jeremy Davis's picture

'apt-cache showpkg' can be useful but IMO policy will give you info that is more directly relevant to what you want to know.

So on my Wheezy desktop system this is what I get:

$ apt-cache policy apache2
apache2:
  Installed: (none)
  Candidate: 2.2.22-13+deb7u5
  Version table:
     2.2.22-13+deb7u5 0
        500 http://security.debian.org/ wheezy/updates/main amd64 Packages
     2.2.22-13+deb7u4 0
        500 http://http.debian.net/debian/ wheezy/main amd64 Packages
This shows that I don't have Apache installed. If I did, then the version installed would show after "Installed:" - instead of "(none)". If I was going to I would get 2.2.22-13+deb7u5 (i.e. the "Candidate:"). Then it shows all the latest versions available and from which repo. So 2.2.22-13+deb7u5 comes from from the Debian security repo.

Also keep in mind that this info relies on the local package database so it's good practice to update that too. So unless you've run apt-get update lately this is probably the way to go:

apt-get update && apt-cache policy apache2