22

I am confused between the term file modification time and file changed time. Can anyone help to make it clearer?

Lii
  • 11,553
  • 8
  • 64
  • 88

1 Answers1

31

mtime is modification time - contents have changed.

ctime is status change time - perms and ownership as well as contents.

Wikipedia says:

* mtime: time of last modification (ls -l),
* ctime: time of last status change (ls -lc) and
* atime: time of last access (ls -lu).

Note that ctime is not the time of file creation. Writing to a file changes its mtime, ctime, and atime. A change in file permissions or file ownership changes its ctime and atime. Reading a file changes its atime. File systems mounted with the noatime option do not update the atime on reads, and the relatime option provides for updates only if the previous atime is older than the mtime or ctime. Unlike atime and mtime, ctime cannot be set with utime() (as used e.g. by touch); the only way to set it to an arbitrary value is by changing the system clock.

pjz
  • 41,842
  • 6
  • 48
  • 60
  • Note there is also a hirarchy: - modification: mtime, ctime, and atime are changed. - status change: ctime and atime are changed. - access: only atime is changed. – Christian Herenz Jul 10 '21 at 00:44
  • The edit queue's full, but if anyone reading this has enough rep, the most up-to-date version of the URL in this post is https://en.wikipedia.org/wiki/Stat_(system_call), and it's worth editing in just to get the https version of the URL. – AJM Aug 17 '22 at 13:15