Meanings of Access,Modify and Change in stat command

I keep forgetting the “subtle” differences between access,modify and change attributes of an inode. I will try to take some note here for you and me. My file test.txt has got the text “abc” in it which is 3 bytes + 1 new line = 4 bytes and I pasted inode information below via stat command.

As it can be seen, file has 4 bytes and access,modify and change attributes are set to the same time stamp. Lets display the file via “cat test.txt” and look at the new stats.

Hmm, only access attribute changed as we didn’t modify the file. Let’s add a single character e.g “d” and save the file and see the stat.

As you can see size is now 5 bytes and all attributes are updated – access,modify,change
Here is the thing. Access and modify are updated along with change why? Indeed if you modify the file, both change and modify values will be updated. Then I ask myself why do I need change attribute then? Indeed if you update anything in inode, only change attribute will be updated. Lets modify file permission to 755 i.e update the inode and see how it will affect the stat output;

Bingo! only “Change” is updated. I hope I won’t forget these after posting this article:)

You have a feedback?

This site uses Akismet to reduce spam. Learn how your comment data is processed.