[root@sre01 ~]# stat nginx-1.18.0
File: ‘nginx-1.18.0’
Size: 158 Blocks: 0 IO Block: 4096 directory
Device: fd00h/64768d Inode: 67183916 Links: 8
Access: (0755/drwxr-xr-x) Uid: ( 1001/ UNKNOWN) Gid: ( 1001/ UNKNOWN)
Context: unconfined_u:object_r:admin_home_t:s0
Access: 2024-10-21 08:49:10.478929863 +0800
Modify: 2020-04-21 22:09:06.000000000 +0800
Change: 2024-10-21 08:49:10.588928511 +0800
Birth: -
- atime (access time) 访问时间,即读取文件内容时间,此字段值会延时更新,以降低IO负载
- mtime(modify time) 修改文件内容的时间
- ctime (change time) 文件元数据发生变化的时间
-t 使用简洁模式显示
[root@sre01 ~]# stat -t nginx-1.18.0
nginx-1.18.0 158 0 41ed 1001 1001 fd00 67183916 8 0 0 1729471750 1587478146 1729471750 0 4096 unconfined_u:object_r:admin_home_t:s0
-f 查看文件所在文件系统的状态
[root@sre01 ~]# stat -f nginx-1.18.0
File: "nginx-1.18.0"
ID: fd0000000000 Namelen: 255 Type: xfs
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 9366049 Free: 8411662 Available: 8411662
Inodes: Total: 18741248 Free: 18659451
-c 使用特定的格式输出
[root@sre01 ~]# stat -c "%n" /etc/passwd
/etc/passwd
[root@sre01 ~]# stat -c "%i" /etc/passwd
34339257
[root@sre01 ~]# stat -c "%a" /etc/passwd
644
可以指定的格式
- %a access rights in octal
- %A access rights in human readable form
- %b number of blocks allocated (see %B)
- %B the size in bytes of each block reported by %b
- %C SELinux security context string
- %d device number in decimal
- %D device number in hex
- %f raw mode in hex
- %F file type
- %g group ID of owner
- %G group name of owner
- %h number of hard links
- %i inode number
- %m mount point
- %n file name
- %N quoted file name with dereference if symbolic link
- %o optimal I/O transfer size hint
- %s total size, in bytes
- %t major device type in hex, for character/block device special files
- %T minor device type in hex, for character/block device special files
- %u user ID of owner
- %U user name of owner
- %w time of file birth, human-readable; - if unknown
- %W time of file birth, seconds since Epoch; 0 if unknown
- %x time of last access, human-readable
- %X time of last access, seconds since Epoch
- %y time of last modification, human-readable
- %Y time of last modification, seconds since Epoch
- %z time of last change, human-readable
- %Z time of last change, seconds since Epoch
- %a free blocks available to non-superuser
- %b total data blocks in file system
- %c total file nodes in file system
- %d free file nodes in file system
- %f free blocks in file system
- %i file system ID in hex
- %l maximum length of filenames
- %n file name
- %s block size (for faster transfers)
- %S fundamental block size (for block counts)
- %t file system type in hex
- %T file system type in human readable form