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

Linux文件的三个时间概念

2017-05-21 18:24 288 查看
系统保存了这三个时间,分别是Accesstime(访问时间),Modify time(修改时间)和Change time(状态时间)。
官方文档给出的解释:
st_atime
Time when file datawas last accessed. Changed by the
following functions: creat(), mknod(), pipe(),
utime(2), andread(2).

st_mtime
Time when data waslast modified. Changed by the fol-
lowing functions: creat(),mknod(), pipe(), utime(),
and write(2).

st_ctime
Time when filestatus was last changed. Changed by the
following functions: chmod(), chown(), creat(),
link(2), mknod(), pipe(), unlink(2), utime(), and
write().文件的 Accesstime,atime 是在读取文件或者执行文件时更改的。
文件的 Modified time,mtime 是在写入文件时随文件内容的更改而更改的。
文件的 Create time,ctime 是在写入文件、更改所有者、权限或链接设置时随 Inode 的内容更改而更改的。
因此,更改文件的内容即会更改 mtime 和 ctime,但是文件的 ctime 可能会在 mtime 未发生任何变化时更改 - 在权限更改,但是文件内容没有变化的情况下。
ll -c 查看文件的ctime
ll -u 查看文件的atime
ll 查看文件的mtime
touch -m命令修改时间戳 实际上变化的是mtime即文件的修改时间
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux