文件系统-4-相关命令汇总

一、命令维度

1. stat

(1) 用法

# stat --help
Toybox 0.8.9-android multicall binary (see toybox --help)

usage: stat [-tfL] [-c FORMAT] FILE...

Display status of files or filesystems.

-c      Output specified FORMAT string instead of default
-f      Display filesystem status instead of file status
-L      Follow symlinks
-t      terse (-c "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o")
              (with -f = -c "%n %i %l %t %s %S %b %f %a %c %d")

The valid format escape sequences for files:
%a  Access bits (octal) |%A  Access bits (flags)|%b  Size/512
%B  Bytes per %b (512)  |%C  Security context   |%d  Device ID (dec)
%D  Device ID (hex)     |%f  All mode bits (hex)|%F  File type
%g  Group ID            |%G  Group name         |%h  Hard links
%i  Inode               |%m  Mount point        |%n  Filename
%N  Long filename       |%o  I/O block size     |%s  Size (bytes)
%t  Devtype major (hex) |%T  Devtype minor (hex)|%u  User ID
%U  User name           |%x  Access time        |%X  Access unix time
%y  Modification time   |%Y  Mod unix time      |%z  Creation time
%Z  Creation unix time

The valid format escape sequences for filesystems:
%a  Available blocks    |%b  Total blocks       |%c  Total inodes
%d  Free inodes         |%f  Free blocks        |%i  File system ID
%l  Max filename length |%n  File name          |%s  Best transfer size
%S  Actual block size   |%t  FS type (hex)      |%T  FS type (driver name)

 

 

 

二、功能维度

1. 查看文件的文件系统类型

8676:
# stat -f -c %T /data/local/tmp/aa.txt //8295是 0xf2f52010 即 F2FS 超级块魔数(F2FS_SUPER_MAGIC)
f2fs
# stat -f -c %T /data/aa.txt //8295是F2FS
f2fs
# stat -f -c %T /proc/meminfo
proc
# stat -f -c %T /sys/bus
sysfs
# stat -f -c %T /dev/stdin
devpts
# stat -f -c %T /sdcard/aa.txt //8295也是
0x65735546 //字符"esUF", 对应的是 FUSE_SUPER_MAGIC,也就是 FUSE 文件系统。

 

posted on 2026-06-06 14:09  Hello-World3  阅读(29)  评论(0)    收藏  举报

导航