stat命令 – 显示文件状态信息

stat 命令用来查看文件的具体存储以及时间等详细信息

语法格式:stat [选项] [参数]

常用参数

参数作用
-L支持符号链接
-f显示文件系统的信息
-t以简洁的方式输出
–help显示命令帮助信息
–version显示命令版本信息

参考实例:

查看文件 anaconda-ks.cfg 的三种时间状态:Access,Modify,Change

[root@proyy.com ~]# stat anaconda-ks.cfg
   File: ‘anaconda-ks.cfg’
   Size: 1229          Blocks: 8          IO Block: 4096   regular file
 Device: fd00h/64768d    Inode: 68898764    Links: 1
 Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
 Context: system_u:object_r:admin_home_t:s0
 Access: 2018-10-25 23:33:49.043028189 +0800
 Modify: 2018-10-26 07:33:10.412027990 +0800
 Change: 2018-10-26 07:33:10.412027990 +0800
  Birth: -

查看文件系统信息

[root@proyy.com ~]# stat -f  anaconda-ks.cfg
   File: "anaconda-ks.cfg"
     ID: fd0000000000 Namelen: 255     Type: xfs
 Block size: 4096       Fundamental block size: 4096
 Blocks: Total: 4587008    Free: 3830110    Available: 3830110
 Inodes: Total: 18358272   Free: 18251208

以简洁的方式输出信息

[root@proyy.com ~]# stat -t  anaconda-ks.cfg
 anaconda-ks.cfg 1229 8 8180 0 0 fd00 68898764 1 0 0 1540481629 1540510390 1540510390 0 4096 system_u:object_r:admin_home_t:s0

命令版本信息

[root@proyy.com ~]# stat --version
 stat (GNU coreutils) 8.22
 Copyright (C) 2013 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.
 Written by Michael Meskes.
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享