首页 > 系统服务 > 详细

Linux文件的三个时间概念

时间:2017-05-21 21:30:06      阅读:315      评论:0      收藏:0      [点我收藏+]

系统保存了这三个时间,分别是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().

文件的 Accesstimeatime 是在读取文件或者执行文件时更改的。
文件的 Modified timemtime 是在写入文件时随文件内容的更改而更改的。
文件的 Create timectime 是在写入文件、更改所有者、权限或链接设置时随 Inode 的内容更改而更改的。

因此,更改文件的内容即会更改 mtime ctime,但是文件的 ctime 可能会在 mtime 未发生任何变化时更改 - 在权限更改,但是文件内容没有变化的情况下。 

ll -c 查看文件的ctime

ll -u 查看文件的atime

ll 查看文件的mtime

touch -m命令修改时间戳 实际上变化的是mtime即文件的修改时间


Linux文件的三个时间概念

原文:http://nightingale.blog.51cto.com/11054237/1927928

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!