每天一个Linux 命令 - stat

stat

stat file/dir

功能 : 显示inode内容
Colors 文件的详细信息

Colors 文件的详细信息
cc@MyLinux:~$ stat Colors 
  File: 'Colors'
  Size: 12          Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d  Inode: 289123      Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/      cc)   Gid: ( 1000/      cc)
Access: 2017-03-04 21:28:57.807863187 -0800
Modify: 2017-03-04 21:28:57.807863187 -0800
Change: 2017-03-04 21:28:57.863865729 -0800
 Birth: -
  • File: 文件名
  • size: 文件大小
  • Blocks: 文件所占用Block的块数
  • IO Block: 文件IO Block的大小
  • regular file: 文件的类型
  • Device: 设备号 以八进制和十进制显示
  • Inode: inode号
  • Links: 硬链接数量
  • Access : 访问权限
  • Uid : 拥有者ID userid
  • Gid : 所在的组的ID
  • Access: 最后访问时间
  • Modify: 文件内容最后修改时间
    -Change: 文件属性最后修改时间
    注:
    Access,Modify ,Change 三者的区别
    虚拟文件系统and软连接硬链接

Details of Linux Stat Command Output

  • File: – Absolute path name of the file.
  • Size: – File size in bytes.
  • Blocks: – Total number of blocks used by this file.
  • IO Block: – IO block size for this file.
  • regular file – Indicates the file type. This indicates that this is a - regular file.
    Following are available file types.
    • regular file. ( ex: all normal files ).
    • directory. ( ex: directories ).
    • socket. ( ex: sockets ).
    • symbolic link. ( ex: symbolic links. )
    • block special file ( ex: hard disk ).
    • character special file. ( ex: terminal device file ).
  • Device: – Device number in hex and device number in decimal
  • Inode: – Inode number is a unique number for each file which is used for the internal maintenance by the file system.
  • Links: 1 – Number of links to the file
  • Access: (0600/-rw——-): Access specifier displayed in both octal and character format. Let us see explanation about both the format.
  • Uid: ( 1000/ sathiya) – File owner’s user id and user name are displayed.
  • Gid: ( 1000/ sathiya) – File owner’s group id and group name are displayed.
  • Access: 2009-06-28 19:29:57.000000000 +0530 – Last access time of the file.
  • Modify: 2009-06-28 19:29:57.000000000 +0530 – Last modification time of the file.
  • Change: 2009-06-28 19:29:57.000000000 +0530 – Last change time of the inode data of that file.

stat -f file/dir

stat -f filename
显示关于文件系统的信息,而非文件本身

cc@MyLinux:~$ stat -f 123.txt 
  File: "123.txt"
    ID: c6f552ab700bb548 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 4869551    Free: 3475145    Available: 3222025
Inodes: Total: 1245184    Free: 1033487

参考:
http://blog.csdn.net/clozxy/article/details/7645284

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 公司附近菜市场里有面包铺子,路过那里的时候,Jens总会两眼放光。 他一向告诉我,德国的面包非常好吃,特别是这种传...
    灰土豆阅读 5,113评论 0 4
  • 生活中,我们常常存在这样一种倾向,那就是把最好的态度奉献给了外人,最坏的一面却展示给了最亲近的人。 也许,在潜意识...
    执念向前阅读 5,185评论 0 3
  • 只在原文更新 一、秘密 小糖球躺在罐子里,丝丝甜香从甜点店里飘到正睡在草地上的薛洋鼻子里 本来睡得正香留着哈喇子的...
    幸村亜夜阅读 6,955评论 2 27
  • 一度不知道怎么确定自己的标题,爱一个动词是个太大的题目,以我浅显的只是只能简单的说出我目前能力范围内对它的理解。 ...
    暖暖百合花阅读 3,101评论 1 1
  •  生产者和消费者问题是操作系统并发性经典问题之一,描述的是有一块缓冲区为仓库,生产者可以将商品放入仓库,消费者可以...
    CleanCode阅读 1,898评论 0 1