atime,为access time的缩写,显示的是文件中的数据最后被访问的时间,比如被系统的进程直接使用或者通过一些命令和脚本间接使用。(执行一些可执行文件、脚本)
mtime,为modify time的缩写,显示的是文件的内容被改变时的最后时间,比如用vi编辑时就会改变。(也就是Block的内容)
ctime,为change time的缩写,显示的是文件的权限,拥有者,所属的组,链接数发生改变时的时间。当然当内容改变时,也会改变。(也就是Inode内容发生改变和Block内容发生改变时)
查看三种时间的方法:
一,使用ls命令。
ls -lc filename 列出文件的 ctime
ls -lu filename 列出文件的 atime
ls -l filename 列出文件的 mtime
二,使用stat命令,stat filename。
File: “hello”
Size: 7139 Blocks: 16 IO Block: 4096 普通文件
Device: 701h/1793d Inode: 128461 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 1000/administrator) Gid: ( 1000/administrator)
Access: 2011-03-15 20:03:50.642835611 +0800
Modify: 2011-02-28 23:06:45.697009961 +0800
Change: 2011-02-28 23:06:45.697009961 +0800
参考:http://www.unixtutorial.org/2008/04/atime-ctime-mtime-in-unix-filesystems/
atime – File Access Time
Access time shows the last time the data from a file was accessed – read by one of the Unix processes directly or through commands and scripts.
ctime – File Change Time
ctime also changes when you change file's ownership or access permissions. It will also naturally highlight the last time file had its contents updated.
mtime – File Modify Time
Last modification time shows time of the last change to file's contents. It does not change with owner or permission changes, and is therefore used for tracking the actual changes to data of the file itself.