stat - 显示文件和文件系统状态
stat 用于显示文件或文件系统的详细状态,包括大小、权限、inode、链接数和时间戳。
查看文件详细信息
stat test示例输出:
File: test
Size: 9 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 16777282 Links: 1
Access: (0755/-rwxr-xr-x) Uid: (0/root) Gid: (0/root)
Access: 2022-03-29 16:54:13.352998075 +0800
Modify: 2022-03-29 14:23:02.468693248 +0800
Change: 2022-03-29 16:53:59.437650907 +0800自定义输出
# 以数字形式显示权限
stat -c '%a' test
# 显示文件大小(字节)
stat -c '%s' test
# 显示 inode 编号
stat -c '%i' test-c、--format 使用指定格式输出,每处理一个文件后追加换行。