如何阅读统计数据的简洁内容?

如何阅读统计数据的简洁内容?

没有给出有关如何解释使用简洁输出运行 stat 命令的结果的线索。

[root@kvm devicemapper]# stat -t data 
data 107374182400 3887728 8180 0 0 fd01 559688 1 0 0 1633555816 1610128779 1610128779 0 4096

我在这里看什么?我认识到其中一些价值观。由于存在重复项,无法将其中一些值映射到它们所代表的任何属性。

stat --version
stat (GNU coreutils) 8.22

更新:看起来 coreutils 开发人员通过在--help使用文档中添加实际的、依赖于系统的格式字符串在更高版本中解决了这个问题。请参阅stat --help输出以了解等效的简洁格式https://github.com/coreutils/coreutils/blob/ebf2c4dcc687c9f057a8a22674fd984aa929012e/src/stat.c#L1792

答案1

检查后代码对于 coreutils 8.22,我的系统上的简洁等效 printf 格式看起来是(未启用 selinux):

[root@kvm devicemapper]# stat -t data 
data 107374182400 3887728 8180 0 0 fd01 559688 1 0 0 1633555816 1610128779 1610128779 0 4096
[root@kvm devicemapper]# stat --printf="%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o\n" data 
data 107374182400 3887728 8180 0 0 fd01 559688 1 0 0 1633555816 1610128779 1610128779 0 4096

(在8.22版本中)那就是:

%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o

%n file name
%s total size, in bytes
%b number of blocks allocated
%f raw mode in hex
%u user ID of owner
%g group ID of owner
%D device number in hex
%i inode number
%h number of hard links
%t major device type in hex, for character/block device special files
%T minor device type in hex, for character/block device special files
%X time of last access, seconds since Epoch
%Y time of last modification, seconds since Epoch
%Z time of last change, seconds since Epoch
%W time of file birth, seconds since Epoch; 0 if unknown
%o optimal I/O transfer size hint

假设您有更高版本的stat,运行时stat --help将包含 terse 的等效格式。

相关内容