Linux下stat命令主要查看文件信息
stat[OPTION]... FILE...
-L显示link文件指向文件信息而非link文件自身
-Z:显示selinux属性
-f:显示文件所在文件系统属性,而不显示文件属性信息
例子:
[root@localhosttmp]# stat -L file1
File: `file1'
Size: 19 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 928090 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ admin) Gid: ( 500/ admin)
Access: 2015-08-16 23:21:52.249119959 -0700
Modify: 2015-08-16 23:22:01.819191317 -0700
Change: 2015-08-16 23:22:01.820214565 -0700
[root@localhost tmp]# stat lii ///lii为指向file1的link文件
File: `lii' -> `/tmp/file1'
Size: 10 Blocks: 0 IO Block: 4096 symbolic link
Device: 802h/2050d Inode: 928390 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2015-08-21 07:04:48.854263500 -0700
Modify: 2015-08-21 07:04:43.693931813 -0700
Change: 2015-08-21 07:04:43.693931813 -0700
[root@localhost tmp]# stat -L lii ///显示link文件指向文件而非link文件本身
File: `lii'
Size: 19 Blocks:8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 928090 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ admin) Gid: ( 500/ admin)
Access: 2015-08-16 23:21:52.249119959 -0700
Modify: 2015-08-16 23:22:01.819191317 -0700
Change: 2015-08-16 23:22:01.820214565 -0700
[root@localhost tmp]# stat -Z file1
File: `file1'
Size: 19 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 928090 Links: 1 Device type: 0,0
Access: (0664/-rw-rw-r--) Uid: ( 500/ admin) Gid: ( 500/ admin)
S_Context: unconfined_u:object_r:user_tmp_t:s0 ////selinux属性
Access: 2015-08-16 23:21:52.249119959 -0700
Modify: 2015-08-16 23:22:01.819191317 -0700
Change: 2015-08-16 23:22:01.820214565 -0700
[root@localhost tmp]# stat -f file1
File: "file1"
ID: 171e51beb7d1d1c Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 4576707 Free: 4010878 Available: 3778392 ///文件系统属性
I nodes: Total: 1163264 Free: 1062847