I am trying to change just the mtime of a directory by adding files or sub directories but that changes the ctime of the file too. Is there any way to just change the mtime without affecting the ctime or atime?

1 Answer 1


It's not possible because ctime is changed always if there is a change of mtime. Here is the explanation:

Let's see from file perspective:

ctime is the inode/file change time, it means that ctime is updated when the file attributes are changed, like changing the owner or the permission.

mtime is the file modify time, it's updated when you modify the content of a file.

Most of the times ctime and mtime will be the same, unless only the file attributes are updated. In that case only the ctime gets updated.

Now from a directory perspective:

A directory is a special kind of file and its content is a set of (filename, i-node) tuples. The mtime of the directory is updated when a tuple is added, removed or changed, it means when a file or directory is added, deleted or renamed, mtime changes and it triggers a change of ctime.

When the metadata of the directory changes (owner, group, mode), mtime is NOT updated but ctime does.

  • I don't understand, that from directory perspective why the mtime change triggers a ctime change?
    – beginer
    Mar 18, 2019 at 0:20
  • 1
    @beginer: any change in mtime, be it a file or directory, triggers a ctime update. That's because ctime tracks metadata modification, and mtime is part of the metadata.
    – MestreLion
    Nov 13, 2019 at 1:39
  • @MestreLion got it, thanks
    – beginer
    Nov 13, 2019 at 3:26

You must log in to answer this question.

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