There are often cases where the file's time attribute is used, and there are three file-related time attributes under Linux. Atime,ctime,mtime. I also often confused, each encounter will be human flesh search, leisure time to prepare this knowledge thoroughly understand. Read the authoritative documents, written easily misunderstood, now according to their own understanding of the 3 parameters explained: CTime file content and any changes in file attributes, CTime will update the time. Mtime records the time when the last file content changed. Atime records the first access time after a change in the contents of a file or a file attribute. ---this need to note, I stepped over the pit to modify the contents of the file, which parameters are changing?
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/A6/D4/wKioL1ncYF2hiVRIAACfkaBbqak537.png-wh_500x0-wm_ 3-wmp_4-s_3929585550.png "style=" Float:none; "title=" modifies the contents of the file. png "alt=" wkiol1ncyf2hivriaacfkabbqak537.png-wh_50 "/ >
When we append the content to the file, we can see that Mtime,ctime has updated the time. Atime has not changed.
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/08/22/wKiom1ncz2yDGzCWAACibriTPXA357.png-wh_500x0-wm_ 3-wmp_4-s_3207112799.png "style=" Float:none; "title=" modifies file properties. png "alt=" wkiom1ncz2ydgzcwaacibritpxa357.png-wh_50 "/ >
When we modify the file attributes, we can see that only ctime updated the time. Mtime,atime has not changed.
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/A6/D4/wKioL1ncYF6R3pR8AACjanck4vs190.png-wh_500x0-wm_ 3-wmp_4-s_3281770434.png "style=" Float:none; "title=" View the modified file. png "alt=" WKIOL1NCYF6R3PR8AACJANCK4VS190.PNG-WH_50 " />
Atime also updates the time when we use tail,more,less to view properties or changes to the content file. If you have not accessed this file, the atime of this file will never be updated.
A common Application scenario:
Some businesses need to periodically delete files that were 2 months old. This scenario is more commonly used and should use Find Dir-mtime +60. And if you use atime,ctime you will experience surprises.
This article is from the Linux system maintenance blog, so be sure to keep this source http://linuxadmin.blog.51cto.com/2683824/1971142
Linux Basics---Understanding of atime,ctime,mtime