关于Linux中的几个时间变量atime,ctime,mtime

王朝system·作者佚名  2006-05-20
窄屏简体版  字體: |||超大  

Linux的文件系统通常包括change time,access time和modification time这3个时间标签。

linux man这么说明这3个变量:

st_atime

Time when file data was last accessed. Changed by the

following functions: creat(), mknod(), pipe(),

utime(2), and read(2).

st_mtime

Time when data was last modified. Changed by the fol-

lowing functions: creat(), mknod(), pipe(), utime(),

and write(2).

st_ctime

Time when file status was last changed. Changed by the

following functions: chmod(), chown(), creat(),

link(2), mknod(), pipe(), unlink(2), utime(), and

write().

这是针对系统调用函数描述的,在实际shell命令中,

touch 影响 atime和mtime,可以通过选项开关选择;

ls未加选项时,time一栏显示的是mtime;

chmod,chown,chgrp影响ctime;

读写操作通常影响atime和mtime;

本源来说,ctime标签由文件系统中inode结构保存;而atime和mtime由目录树保存。一般的参数中提到的,除非明确指出,都是“最后一次内容被修改时的时间”,e.g当执行find时的-newer和-older指的也是mtime。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航