Knowing the difference between mtime, ctime and atime

If you are dealing with files, you might wonder what the difference is between mtime, ctime and atime.

mtime, or modification time, is when the file was last modified. When you change the contents of a file, its mtime changes.

ctime, or change time, is when the file’s property changes. It will always be changed when the mtime changes, but also when you change the file’s permissions, name or location.

atime, or access time, is updated when the file’s contents are read by an application or a command such as grep or cat.

The easiest way to remember which is which is to read their alphabetical order:

  • Atime can be updated alone
  • Ctime will update atime
  • Mtime will update both atime and ctime.

2 comments on “Knowing the difference between mtime, ctime and atime

  1. Hi!

    Thank you for this, I now have an understanding of what those terms mean. I found them in PHP while searching and got confused of what to use in order to determine modified files. I just tried this out, I saved a file without changing any of it’s content, just hitting CTRL+S. The file’s mtime changed. Is that alright or am I missing something?

    • Some editors will write the file regardless of whether the content has changed or not. I think that’s the reason that you see mtime get changed.

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see