文件的时间属性atime,mtime,ctime

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了文件的时间属性atime,mtime,ctime相关的知识,希望对你有一定的参考价值。

atime (access time)最近访问内容的时间

mtime (modify time)最近修改内容的时间

ctime (change time)最近更改文件的时间,包括文件名、大小、内容、权限、属主、属组等

stat filename 查看文件的三个时间属性

echo "dahdgajk">>filename 追加内容会改变文件的mtime和ctime

cat filename 查看文件内容会改变文件的atime

touch filename 会改变文件的三个time

chmod 777 filename 更改文件权限会改变文件的ctime

除了touch命令可以更改三个time外,一般情况下,只访问文件内容只会改变atime,

修改文件内容会同时mtime和ctime,修改文件名、权限、属主、属组只改变ctime,

证明mtime属于ctime的子集,mtime改变,ctime一定改变;反之,不一定


以上是关于文件的时间属性atime,mtime,ctime的主要内容,如果未能解决你的问题,请参考以下文章

linux基础---关于atime,ctime,mtime的理解

ctime,atime,mtime

Linux下find , atime, ctime,mtime

Linux时间戳atime ctime mtime区别及相关命令

ctime和mtime和atime的区别

Linux中ctime mtime atime文件时间的区别