Linux: The differences between file times: atime (accessed time), ctime (changed time) and mtime (modified time).

Unless you have explicitly opted out with a noatime option mounting your Linux file system, there are generally 3 types of time on each and every file of Linux: atime or access time, ctime or change time, and mtime or modification time.

These are the differences between the 3 file system times:

  1. atime — access time, or the last accessed time of a file or directory, whenever you accessed, opened or touched it, the atime is updated to the current time. You can get the file atime value in PHP.
  2. ctime — change time, or the last changed time of the file or directory, whenever you change and update the file such as changing the file ownership or permissions or modifying the file content, the ctime of the file is updated to the current time. You can get the file ctime in PHP.
  3. mtime — modification time, or the last modified time of the file or directory, whenever you modify and update the content of the file. Modifying file ownerships or permissions doesn’t change mtime of the file. To get mtime of a file in PHP, you need a the php function filemtime.

3 thoughts on “Linux: The differences between file times: atime (accessed time), ctime (changed time) and mtime (modified time).”

  1. Linux file ctime vs. mtime (differences):

    mtime is last time the content of the file is modified; while ctime is the last time the file is changed, not only regarding content, but also the meta information such as owner, group and permissions.

  2. Pingback: Linux: Find files changed or modified within 1 day or lder than 1 day

Comments are closed.

Scroll to Top