我该如何检查coreutils版本?

我如何检查coreutils的版本? gnu coreutils表示他们的版本为5.我确定Ubuntu是一个变种。 我试过了:

info coreutils File: coreutils.info, Node: coreutils invocation, Prev: Standards conformance, Up: Common options 2.14 'coreutils': Multi-call binary 

版本真的是2.14吗? 看起来真的过时了。 是对的吗? 或者我检查错误的东西?

简短回答 – 检查apt-cache policy输出中的Installed字段:

 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 

使用dpkg -s查看安装了哪个版本的软件包。

 sudo dpkg -s coreutils 

这应该给你这样的东西:

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

如您所见,我安装了8.21-1ubuntu5.1版本。

我五十美分🙂

  • 使用dpkg-query

     % dpkg-query --show coreutils coreutils 8.23-4ubuntu2 
  • 使用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 

最新版本的coreutils是8.24,看着GNU镜像 。

在Ubuntu存储库中, 对于15.04 / 15.10 / 16.04 ,最新版本为8.23 :

 Package coreutils precise (12.04LTS) (utils): GNU core utilities 8.13-3ubuntu3.3 [security]: amd64 i386 precise-updates (utils): GNU core utilities 8.13-3ubuntu3.3: amd64 i386 trusty (14.04LTS) (utils): GNU core utilities 8.21-1ubuntu5.1 [security]: amd64 i386 trusty-updates (utils): GNU core utilities 8.21-1ubuntu5.1: amd64 i386 vivid (utils): GNU core utilities 8.23-3ubuntu1: amd64 i386 wily (utils): GNU core utilities 8.23-4ubuntu2: amd64 i386 xenial (utils): GNU core utilities 8.23-4ubuntu2: amd64 i386 

你可以做dpkg -s

对于coreutils,该命令的输出将是:

 Section: utils Installed-Size: 12955 Maintainer: Michael Stone  Architecture: armhf Multi-Arch: foreign Version: 8.23-4 Replaces: mktemp, realpath, timeout Pre-Depends: libacl1 (>= 2.2.51-8), libattr1 (>= 1:2.4.46-8), libc6 (>= 2.17), libselinux1 (>= 2.1.13) Conflicts: timeout Description: GNU core utilities This package contains the basic file, shell and text manipulation utilities which are expected to exist on every operating system. Specifically, this package includes: arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false flock fmt fold groups head hostid id install join link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir runcon sha*sum seq shred sleep sort split stat stty sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink users vdir wc who whoami yes Homepage: http://gnu.org/software/coreutils