linux系统中的atime,mtime,ctime三种时间区别

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.

转载于:https://my.oschina.net/xngiser/blog/14196

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值