ctime、atime、mtime的區別

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().


文件的 Access time,atime 是在讀取文件或者執行文件時更改的。
文件的 Modified time,mtime 是在寫入文件時隨文件內容的更改而更改的。
文件的 Create time,ctime 是在寫入文件、更改所有者、權限或鏈接設置時隨 Inode 的內容更改而更改的。

因此,更改文件的內容即會更改 mtime 和 ctime,但是文件的 ctime 可能會在 mtime 未發生任何變化時更改 - 在權限更改,但是文件內容沒有變化的情況下。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章