Linux运维系统工程师系列---08
[root@server254 stk]# ll jk
-rw-rwxr--+ 1 joke joke 10 Oct 17 09:45 jk
stat:显示文件和文件系统的状态,也可以读取文件的inode信息
[root@server254 ~]# mkdir /test
[root@server254 ~]# cd /test/
[root@server254 test]# echo happy > 1017
[root@server254 test]# stat 1017
File: `1017‘
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050dInode: 655376 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-10-17 10:14:19.569022191 +0800
Modify: 2013-10-17 10:14:19.569022191 +0800
Change: 2013-10-17 10:14:19.569022191 +0800
Modify:mtime——modify time:修改文件内容的时间
vim :如果修改内容,三个时间均发生变化
[root@server254 test]# stat 1017
File: `1017‘
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050dInode: 655376 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-10-17 10:18:09.466020132 +0800
Modify: 2013-10-17 10:14:19.569022191 +0800
Change: 2013-10-17 10:14:19.569022191 +0800
[root@server254 test]# vim 1017
[root@server254 test]# stat 1017
File: `1017‘
Size: 10 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050dInode: 655378 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-10-17 10:20:57.377020788 +0800
Modify: 2013-10-17 10:20:57.377020788 +0800
Change: 2013-10-17 10:20:57.390020657 +0800
echo >> :mtime和ctime发生变化
[root@server254 test]# stat 1017
File: `1017‘
Size: 10 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050dInode: 655378 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-10-17 10:21:49.187020625 +0800
Modify: 2013-10-17 10:20:57.377020788 +0800
Change: 2013-10-17 10:20:57.390020657 +0800
[root@server254 test]# echo hello >> 1017
[root@server254 test]# stat 1017
File: `1017‘
Size: 16 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050dInode: 655378 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-10-17 10:21:49.187020625 +0800
Modify: 2013-10-17 10:23:20.183020715 +0800
Change: 2013-10-17 10:23:20.183020715 +0800
Access:atime——access time:查看文件的时间,cat,more
rhel 5:当你cat文件时候,atime是变的。
rhel 6:优化了,只变一次
Change:ctime——change time:修改文件的属性的时候变化(如改名、大小变化、改权限等等)
本文出自 “空谷幽兰” 博客,请务必保留此出处http://2489843.blog.51cto.com/2479843/1388713
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。