apt-cache check package version on Debian/Ubuntu Linux

Fig.01: apt-cache check package version on Debian/Ubuntu Linux

Fig.01: apt-cache check package version on Debian/Ubuntu Linux

To check package version using apt-cache on Debian and Ubuntu Linux server, run:
$ apt-cache policy {PKG}
$ apt-cache policy nginx

Sample outputs:

nginx:
  Installed: (none)
  Candidate: 1.9.12-0ubuntu1
  Version table:
     1.9.12-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/main i386 Packages

Another option is:
$ apt-cache madison {PKG}
$ apt-cache madison nginx

Sample outputs:

     nginx | 1.9.12-0ubuntu1 | http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
     nginx | 1.9.12-0ubuntu1 | http://us.archive.ubuntu.com/ubuntu xenial/main i386 Packages

It is clear that I will be installing nginx version 1.9.12.

Examples and usage: How to check Debian/Ubuntu Linux package version using apt-get/aptitude command