179

The stat command's manual page says:

   %x     Time of last access
   %y     Time of last modification
   %z     Time of last change

I cannot understand the difference between modify and change. I understand the words are synonyms (English is not my native language), but their output is different.

I tried the following command

stat --printf="Change %z\nAccess %x\nModify %y\n" p.txt

Now when I open p.txt, access time is changed, I go into insert mode, edit the file, modify and change time remains same.

Change 2010-10-06 12:48:39.286252389 +0500
Access 2010-10-06 12:49:14.962243456 +0500
Modify 2010-10-06 12:48:39.234498878 +0500

When I write the changes to file :w, modify and change, both change but give different values.

Change 2010-10-06 12:51:21.949082169 +0500
Access 2010-10-06 12:51:21.908246082 +0500
Modify 2010-10-06 12:51:21.908246082 +0500

So what are the meanings of "modify" and "change" in this context? That is, time of modification and change give time of which events?

Thanks

wjandrea
  • 658
  • 12
    To make it even funnier, in my localized --help it reads something like "last modify" and "last modified" since we don't have two words for modify/change. – Camilo Martin Jul 27 '12 at 15:21
  • 5
    @CamiloMartin that is an awful disservice by the translator. If you know English, I recommend using only english environment - much easier to understand the original documentation writer's intention and also much easier to find help online. – Ján Lalinský Jan 31 '19 at 17:56

1 Answers1

204

This has already been answered in this question, which I quote (original text by echox):

There are 3 kind of "timestamps":

  • Access - the last time the file was read
  • 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)

This post on Stack Overflow explains the difference among the three different times from a programming interface point of view.

  • Thank you for not closing this as a duplicate. A websearch took me to this question, because unlike the first question you linked to, it actually contains the word 'changed'. I would also argue that the correct place for this question is indeed here, and not StackOverflow, since it's a *nix question, and not really a programming question. – Michael Scheper Sep 13 '23 at 20:06