linux stat命令参数详解
2013-09-04 15:23
357 查看
stat
-L, --dereference follow links 如果是链接文件,则获取原文件信息
-Z, --context print the security context information if available
打印SElinux安全上下文信息
-f, --file-system display file system status instead of file status
显示文件所在的文件系统的状态
-c --format=FORMAT use the specified FORMAT instead of the default;
output a newline after each use of FORMAT
自定义输出格式,结尾有换行
--printf=FORMAT like --format, but interpret backslash escapes,
and do not output a mandatory trailing newline.
If you want a newline, include \n in FORMAT.
自定义输出格式,结尾无换行符,需手动添加
-t, --terse print the information in terse form
以简洁的形式打印输出信息(在没有改变输出格式的情况下)
--help display this help and exit
打印帮助信息
--version output version information and exit
打印版本信息并退出
可选的文件信息输出格式
%a Access rights in octal 八进制格式的文件访问权限
%A Access rights in human readable form 可读形式访问权限(ls -l情况下显示的样子)
%b Number of blocks allocated (see %B) 分配的块数(单位参照%B的数值)
%B The size in bytes of each block reported by %b
每个块的大小(这个值是指硬盘上存储单元块的大小,与格式化的block块大小不同)
%d Device number in decimal 设备号(10进制)
%D Device number in hex 设备号(十六进制)
%f Raw mode in hex raw模式(十六进制,可以百度一下raw的意思)
%F File type 文件类型
%g Group ID of owner 文件所有者的组ID
%G Group name of owner 文件所有者的组名
%h Number of hard links 硬链接的数量(文件本身算1个)
%i Inode number inode号
%n File name 文件名
%N Quoted file name with dereference if symbolic link
取消软连接的文件名引用,变成普通字符串
%o I/O block size 系统格式化block的大小
%s Total size, in bytes 文件大小(单位byte)
%t Major device type in hex 主要设备类型(十六进制)
%T Minor device type in hex 次要设备类型(十六进制)
%u User ID of owner 所有者的用户ID
%U User name of owner 所有者的用户名
%x Time of last access 最后访问时间
%X Time of last access as seconds since Epoch 最后一次访问时间(大纪元秒)
%y Time of last modification 最后修改时间(内容改变)
%Y Time of last modification as seconds since Epoch 最后修改时间(内容改变)
%z Time of last change 最后改变时间(文件属性,权限所有者等,格式大纪元秒)
%Z Time of last change as seconds since Epoch
最后改变时间(文件属性,权限所有者等,格式大纪元秒)
stat -c "%a %A %b %B %d %D %f %F %g %G %h %i %n %N %o %s %t %T %u %U %x %X %y %Y %z %Z" file
可选的分区信息输出格式
%a Free blocks available to non-superuser 普通用户可用的block数量
%b Total data blocks in file system 分区的总数据块数量
%c Total file nodes in file system 文件系统的inode总数
%d Free file nodes in file system 空闲inode数量
%f Free blocks in file system 可用的block数量
%C Security context in SELinux selinux 安全上下文
%i File System ID in hex 分区ID(十六进制)
%l Maximum length of filenames 分区文件名最大长度
%n File name 文件名
%s Block size (for faster transfers) 块大小(都是系统block的大小)
%S Fundamental block size (for block counts) 基本块大小(都是系统block的大小)
%t Type in hex 文件系统类型(格式化的类型,十六进制)
%T Type in human readable form 文件系统类型(格式化的类型,可读形式)
stat -f -c "%a %b %c %d %f %C %i %l %n %s %S %t %T" file
-L, --dereference follow links 如果是链接文件,则获取原文件信息
-Z, --context print the security context information if available
打印SElinux安全上下文信息
-f, --file-system display file system status instead of file status
显示文件所在的文件系统的状态
-c --format=FORMAT use the specified FORMAT instead of the default;
output a newline after each use of FORMAT
自定义输出格式,结尾有换行
--printf=FORMAT like --format, but interpret backslash escapes,
and do not output a mandatory trailing newline.
If you want a newline, include \n in FORMAT.
自定义输出格式,结尾无换行符,需手动添加
-t, --terse print the information in terse form
以简洁的形式打印输出信息(在没有改变输出格式的情况下)
--help display this help and exit
打印帮助信息
--version output version information and exit
打印版本信息并退出
可选的文件信息输出格式
%a Access rights in octal 八进制格式的文件访问权限
%A Access rights in human readable form 可读形式访问权限(ls -l情况下显示的样子)
%b Number of blocks allocated (see %B) 分配的块数(单位参照%B的数值)
%B The size in bytes of each block reported by %b
每个块的大小(这个值是指硬盘上存储单元块的大小,与格式化的block块大小不同)
%d Device number in decimal 设备号(10进制)
%D Device number in hex 设备号(十六进制)
%f Raw mode in hex raw模式(十六进制,可以百度一下raw的意思)
%F File type 文件类型
%g Group ID of owner 文件所有者的组ID
%G Group name of owner 文件所有者的组名
%h Number of hard links 硬链接的数量(文件本身算1个)
%i Inode number inode号
%n File name 文件名
%N Quoted file name with dereference if symbolic link
取消软连接的文件名引用,变成普通字符串
%o I/O block size 系统格式化block的大小
%s Total size, in bytes 文件大小(单位byte)
%t Major device type in hex 主要设备类型(十六进制)
%T Minor device type in hex 次要设备类型(十六进制)
%u User ID of owner 所有者的用户ID
%U User name of owner 所有者的用户名
%x Time of last access 最后访问时间
%X Time of last access as seconds since Epoch 最后一次访问时间(大纪元秒)
%y Time of last modification 最后修改时间(内容改变)
%Y Time of last modification as seconds since Epoch 最后修改时间(内容改变)
%z Time of last change 最后改变时间(文件属性,权限所有者等,格式大纪元秒)
%Z Time of last change as seconds since Epoch
最后改变时间(文件属性,权限所有者等,格式大纪元秒)
stat -c "%a %A %b %B %d %D %f %F %g %G %h %i %n %N %o %s %t %T %u %U %x %X %y %Y %z %Z" file
可选的分区信息输出格式
%a Free blocks available to non-superuser 普通用户可用的block数量
%b Total data blocks in file system 分区的总数据块数量
%c Total file nodes in file system 文件系统的inode总数
%d Free file nodes in file system 空闲inode数量
%f Free blocks in file system 可用的block数量
%C Security context in SELinux selinux 安全上下文
%i File System ID in hex 分区ID(十六进制)
%l Maximum length of filenames 分区文件名最大长度
%n File name 文件名
%s Block size (for faster transfers) 块大小(都是系统block的大小)
%S Fundamental block size (for block counts) 基本块大小(都是系统block的大小)
%t Type in hex 文件系统类型(格式化的类型,十六进制)
%T Type in human readable form 文件系统类型(格式化的类型,可读形式)
stat -f -c "%a %b %c %d %f %C %i %l %n %s %S %t %T" file
相关文章推荐
- Linux 中 RPM 命令参数使用详解
- linux whoami命令参数及用法详解--linux查看登陆用户名
- linux uname命令参数及用法详解--linux查看系统信息命令
- linux chsh命令参数及用法详解(linux设置系统shell命令)
- linux eval命令参数及用法详解--linux重新运算求出参数的内容
- linux中mount命令参数详解(nfs 参数)
- Linux 定时任务命令Crontab参数详解
- linux的top命令参数详解
- linux -- dd 命令参数详解
- linux edquota命令参数及用法详解---linux 编辑用户或群组的quota
- linux unzip/zip命令参数及用法详解
- linux的top命令参数详解
- linux su命令参数及用法详解(linux切换用户命令)
- linux的top命令参数详解
- linux resize命令参数及用法详解--linux设置终端窗口大小命令
- linux kill命令参数及用法详解--linux终止进程命令
- 详解Linux patch命令参数及用法
- linux基础命令参数详解之pwd
- linux tar命令参数及用法详解--linux打包备份命令
- rpm命令|rpm安装|rpm卸载|rpm使用|rpm删除 Linux 中 RPM 命令参数使用详解