• 重要通知:网站内容不做更新,只对现有的进行扩展,新技术资料已转移到其它位置存储。

  • 通知:2021年3月21日将博客服务器迁移,感谢好友老刘提供的服务器!!!
    点击查看具体站点更新信息

  • 提示:站点启用不定时清理注册未登录的帐户,已登录过用户请无视!

  • 通知:2019年5月18日网站迎来一波大更新!!!

    点击查看具体站点更新信息

stat命令查看文件、目录或文件系统状态

系统集成 盛行 8年前 (2014-05-03) 2167次浏览 已收录 0个评论 扫描二维码
文章目录
[隐藏]

1.释义

查看文件、目录或文件系统状态

2.系统帮助

用法:stat [选项]... 文件...
Display file or file system status.

Mandatory arguments to long options are mandatory for short options too.
  -L, --dereference     follow links
  -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		显示此帮助信息并退出
      --version		显示版本信息并退出

The valid format sequences for files (without --file-system):

  %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

Valid format sequences for file systems:

  %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

注意:您的shell 内含自己的stat 程序版本,它会覆盖这里所提及的相应
版本。请查阅您的shell 文档获知它所支持的选项。

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
请向<http://translationproject.org/team/zh_CN.html> 报告stat 的翻译错误
要获取完整文档,请运行:info coreutils 'stat invocation'

3.示例

3.1.查看文件状态

[root@itbkz.com s]#stat /etc/passwd
  文件:"/etc/passwd"
  大小:918       	块:8          IO 块:4096   普通文件
设备:fd00h/64768d	Inode:18746787    硬链接:1
权限:(0644/-rw-r--r--)  Uid:(    0/    root)   Gid:(    0/    root)
最近访问:2019-11-29 21:01:46.223518587 +0800
最近更改:2019-11-29 21:01:44.167479375 +0800
最近改动:2019-11-29 21:01:44.182479661 +0800
创建时间:-
最近访问:Access timeatime);最近更改:Modify timemtime);最近改动:Change timectime

IT博客站版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:stat命令查看文件、目录或文件系统状态
喜欢 (0)
[使用支付宝扫码]
分享 (0)
盛行
关于作者:
企业应用技术爱好者,喜欢分享知识。如果文章中有错误,欢迎指正,谢谢。
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址