Using apt-get how to check have installed latest version ?

Solution 1:

Use the apt-cache policy command:

$ apt-cache policy openjdk-6-jre
openjdk-6-jre:
  Installed: (none)
  Candidate: 6b32-1.13.4-4ubuntu0.14.04.1
  Version table:
     6b32-1.13.4-4ubuntu0.14.04.1 0
        500 http://aptmirror.fqdn/ubuntu/ trusty-security/universe amd64 Packages
     6b31-1.13.3-1ubuntu1 0
        500 http://aptmirror.fqdn/ubuntu/ trusty/universe amd64 Packages

It says that I don't have any version installed, and of the available versions, 6b32-1.13.4-4ubuntu0.14.04.1 (the candidate) will be installed if I do sudo apt-get install openjdk-6-jre.

Even if you have it installed already, if you do sudo apt-get install openjdk-6-jre, the latest version available (according to the Candidate field above) will be installed. So an installed package will be upgraded.

You can press CtrlC to exit from most programs, including sudo password prompts and apt-get. It's a very bad idea to do so with apt-get. You can cancel while the download is in progress, but once the installation begins, don't do so.