设为首页 收藏本站
查看: 663|回复: 0

[经验分享] Linux stat

[复制链接]

尚未签到

发表于 2018-5-21 06:49:50 | 显示全部楼层 |阅读模式
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

  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-477577-1-1.html 上篇帖子: linux网关查看 下篇帖子: linux新手入门学习
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表