每天一个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

你可能感兴趣的:(每天一个Linux 命令 - stat)