atime、mtime、ctime讲解
2014-03-30 11:38
232 查看
linux下文件没有创建时间,只有atime、mtime、ctime三个时间。
命令:stat filename 查看三个时间
[root@server test]# stat file
File: `file'
Size: 73 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279310 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-03-30 03:20:44.691532547 +0800
Modify: 2014-03-30 03:20:44.691532547 +0800
Change: 2014-03-30 03:20:44.720532697 +0800
其中:atime(access time)在读取文件或者执行文件时会更改变。
mtime(modify time)在文件内容改变或执行文件时会更改变。
ctime(change time)在写入文件更改文件所有者、权限或链接时会改变。
例子:
[root@server test]# cat file
The purpose of this document is to compare the atime mtime ctime changes
[root@server test]# stat file
File: `file'
Size: 73 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279310 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-03-30 03:23:59.676533615 +0800 //atime改变
Modify: 2014-03-30 03:20:44.691532547 +0800
Change: 2014-03-30 03:20:44.720532697 +0800
[root@server test]# vim file //添加了一行
[root@server test]# stat file
File: `file'
Size: 102 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800 //三个时间都发生改变
Modify: 2014-03-30 03:26:37.847534204 +0800
Change: 2014-03-30 03:26:37.859533622 +0800
[root@server test]# chmod 777 file
[root@server test]# stat file
File: `file'
Size: 102 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800
Modify: 2014-03-30 03:26:37.847534204 +0800
Change: 2014-03-30 03:27:20.338530935 +0800 //ctime改变
[root@server test]# chown user1 file
[root@server test]# stat file
File: `file'
Size: 102 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 501/ user1) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800
Modify: 2014-03-30 03:26:37.847534204 +0800
Change: 2014-03-30 03:30:41.599532182 +0800 //ctime改变
[root@server test]# ln file file.link
[root@server test]# stat file
File: `file'
Size: 102 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 2
Access: (0777/-rwxrwxrwx) Uid: ( 501/ user1) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800
Modify: 2014-03-30 03:26:37.847534204 +0800
Change: 2014-03-30 03:31:49.151541931 +0800 //ctime改变
[root@server test]# echo "add one line" >>file
[root@server test]# stat file
File: `file'
Size: 115 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 2
Access: (0777/-rwxrwxrwx) Uid: ( 501/ user1) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800
Modify: 2014-03-30 03:34:11.254531631 +0800 //mtime、ctime都改变
Change: 2014-03-30 03:34:11.254531631 +0800
本文出自 “linux成长之路” 博客,请务必保留此出处http://linuxlovers.blog.51cto.com/6787002/1386830
命令:stat filename 查看三个时间
[root@server test]# stat file
File: `file'
Size: 73 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279310 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-03-30 03:20:44.691532547 +0800
Modify: 2014-03-30 03:20:44.691532547 +0800
Change: 2014-03-30 03:20:44.720532697 +0800
其中:atime(access time)在读取文件或者执行文件时会更改变。
mtime(modify time)在文件内容改变或执行文件时会更改变。
ctime(change time)在写入文件更改文件所有者、权限或链接时会改变。
例子:
[root@server test]# cat file
The purpose of this document is to compare the atime mtime ctime changes
[root@server test]# stat file
File: `file'
Size: 73 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279310 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-03-30 03:23:59.676533615 +0800 //atime改变
Modify: 2014-03-30 03:20:44.691532547 +0800
Change: 2014-03-30 03:20:44.720532697 +0800
[root@server test]# vim file //添加了一行
[root@server test]# stat file
File: `file'
Size: 102 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800 //三个时间都发生改变
Modify: 2014-03-30 03:26:37.847534204 +0800
Change: 2014-03-30 03:26:37.859533622 +0800
[root@server test]# chmod 777 file
[root@server test]# stat file
File: `file'
Size: 102 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800
Modify: 2014-03-30 03:26:37.847534204 +0800
Change: 2014-03-30 03:27:20.338530935 +0800 //ctime改变
[root@server test]# chown user1 file
[root@server test]# stat file
File: `file'
Size: 102 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 501/ user1) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800
Modify: 2014-03-30 03:26:37.847534204 +0800
Change: 2014-03-30 03:30:41.599532182 +0800 //ctime改变
[root@server test]# ln file file.link
[root@server test]# stat file
File: `file'
Size: 102 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 2
Access: (0777/-rwxrwxrwx) Uid: ( 501/ user1) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800
Modify: 2014-03-30 03:26:37.847534204 +0800
Change: 2014-03-30 03:31:49.151541931 +0800 //ctime改变
[root@server test]# echo "add one line" >>file
[root@server test]# stat file
File: `file'
Size: 115 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 279309 Links: 2
Access: (0777/-rwxrwxrwx) Uid: ( 501/ user1) Gid: ( 0/ root)
Access: 2014-03-30 03:26:37.847534204 +0800
Modify: 2014-03-30 03:34:11.254531631 +0800 //mtime、ctime都改变
Change: 2014-03-30 03:34:11.254531631 +0800
本文出自 “linux成长之路” 博客,请务必保留此出处http://linuxlovers.blog.51cto.com/6787002/1386830
相关文章推荐
- Find–atime –ctime –mtime的用法与区别总结
- Find–atime –ctime –mtime的用法与区别总结
- atime|mtime|ctime
- mtime,ctime,atime
- atime,mtime,ctime以及find指令
- 每天一个Linux命令-9(Find–atime –ctime –mtime)
- Find–atime –ctime –mtime的用法与区别总结
- Find–atime –ctime –mtime的用法与区别总结
- atime、mtime、ctime
- atime、mtime、ctime
- Find–atime –ctime –mtime的用法与区别总结
- Find–atime –ctime –mtime的用法与区别总结
- atime、mtime、ctime的区别及如何降低atime更新 mount时的option noatime
- atime、mtime、ctime
- Find–atime –ctime –mtime的用法与区别总结
- Find–atime –ctime –mtime的用法与区别总结
- linux中ctime,mtime,atime的区别
- Linux的三个时间(mtime\ctime\atime)
- 对atime、mtime和ctime的研究
- Linux文件与目录的三种时间状态(mtime,atime,ctime)区别