How to check package version with apt-get?

For installed packages, we can use “dpkg -l” to find out the version number of a specified package. For example,

root@test:~# dpkg -l nginx
| 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  nginx                          1.2.1-2.2+wheezy2    all                  small, powerful, scalable web/proxy server

If we don’t have the package installed, how can we find its version? Well, apt-cache is the way to go. We can use apt-cache to find out which version of a specified package we are going to installed. Here are two examples,

Example 1:

root@27800:~# apt-cache policy nmap
  Installed: (none)
  Candidate: 6.00-0.3+deb7u1
  Version table:
     6.00-0.3+deb7u1 0
        500 stable/main i386 Packages

Example 2:

root@27800:~# apt-cache show nmap
Package: nmap
Version: 6.00-0.3+deb7u1
Installed-Size: 14888
Maintainer: LaMont Jones <>
Architecture: i386
Replaces: ndiff
Provides: ndiff
Depends: libc6 (>= 2.7), libgcc1 (>= 1:4.1.1), liblinear1 (>= 1.6), liblua5.1-0, libpcap0.8 (>= 0.9.8), libpcre3 (>= 8.10), libssl1.0.0 (>= 1.0.0), libstdc++6 (>= 4.6), python
Conflicts: ndiff
Description-en: The Network Mapper
 Nmap is a utility for network exploration or security auditing. It
 supports ping scanning (determine which hosts are up), many port
 scanning techniques, version detection (determine service protocols
 and application versions listening behind ports), and TCP/IP
 fingerprinting (remote host OS or device identification). Nmap also
 offers flexible target and port specification, decoy/stealth scanning,
 sunRPC scanning, and more. Most Unix and Windows platforms are
 supported in both GUI and commandline modes. Several popular handheld
 devices are also supported, including the Sharp Zaurus and the iPAQ.
Description-md5: bc417f4c1fdba7d8d9b0ca8a2a90b7a8
Tag: admin::monitoring, implemented-in::c, interface::commandline,
 network::scanner, role::program, scope::utility, use::scanning
Section: net
Priority: extra
Filename: pool/main/n/nmap/nmap_6.00-0.3+deb7u1_i386.deb
Size: 3704668
MD5sum: ad2f5e35475c94b8c615f21377cfb011
SHA1: b24c2b3a97e7242644fe7639d0f1a7e5efcdd719
SHA256: bed75366e30fa1505ba1841adb780084e2a54bad1375df6e612e7c3aaa0e86c7
Share Button

Leave a comment

Your email address will not be published. Required fields are marked *