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

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

2006-05-19 11:39 836 查看
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。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: