您的位置:首页 > 运维架构 > Linux

Linux运维系统工程师系列---08

2014-04-02 08:02 239 查看
[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:修改文件的属性的时候变化(如改名、大小变化、改权限等等)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息