I'm trying to clear out how the timestamps of a file on linux work.

In this answer is stated:

Modify - the last time the file was modified (content has been modified)

Change - the last time meta data of the file was changed (e.g. permissions)

but every time I change the file contents the ctime is also altered. It leads to me to think that it's like a change reaction:

  1. The change in file contents triggers a change in mtime
  2. The change in mtime (file metadata) triggers a change in ctime

If that's true, then ctime will allways be >= than mtime.

Is this assumption correct on every situation? (assuming the system time is never altered manually)


1 Answer 1


No: you can set mtime (modification time) and atime (access time) to arbitrary timestamps (within the limits of the time_t data type, including dates in the future. After doing this, ctime will be the current time.

The utimes function (which updates mtime and atime) accepts a pair of timeval structures, which combine time_t (seconds) and and microseconds, potentially increasing the resolution, but not limited to times in the past.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .