how do I check coreutils version?

Solution 1:

Short answer - check the Installed field in the output of apt-cache policy :

testdir:$ apt-cache policy coreutils
coreutils:
  Installed: 8.21-1ubuntu5.1
  Candidate: 8.21-1ubuntu5.1
      Version table:
 *** 8.21-1ubuntu5.1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     8.21-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Solution 2:

Use dpkg -s to see which version of a package is installed.

sudo dpkg -s coreutils

That should give you something like this:

Package: coreutils
Essential: yes
Status: install ok installed
Priority: required
Section: utils
Installed-Size: 6020
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Multi-Arch: foreign
Version: 8.21-1ubuntu5.1
...

As you can see, I have version 8.21-1ubuntu5.1 installed.

Solution 3:

My fifty cents :)

  • With dpkg-query

    % dpkg-query --show coreutils
    coreutils   8.23-4ubuntu2
    
  • With axi-cache

    % axi-cache policy coreutils
    coreutils:
      Installed: 8.23-4ubuntu2
      Candidate: 8.23-4ubuntu2
      Version table:
     *** 8.23-4ubuntu2 0
            500 http://archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
            100 /var/lib/dpkg/status