7

I'm using Ubuntu 12.04, though I'd imagine this question spans all Linux variants. In the manpage for the stat command, there are two (four) formatting options that appear to mean the same thing:

The valid format sequences for files (without --file-system):

...

%y Time of last modification, human-readable

%Y Time of last modification, seconds since Epoch

%z Time of last change, human-readable

%Z Time of last change, seconds since Epoch

However, these values aren't always equal. For example, stat --printf="%y\n%z\n" /usr/local on my system outputs the following:

2012-04-26 10:29:13.000000000 -0500

2013-05-06 18:08:19.000000000 -0500

So what is the difference between "change time" and "modification time"?

blakeo_x
  • 173
  • 1
  • 4

1 Answers1

14

Last modification time - the last time the file was modified (content has been modified)

Last change time - the last time /metadata/ of the file was changed (e.g. permissions)

Ruairí N.
  • 256
  • 2
  • 2
  • 2
    It also has to be noted that mtime can be set to anything you want, ctime can't. – Halfgaar Oct 15 '13 at 16:29
  • @Halfgaar could you elaborate on that a bit? –  Oct 15 '13 at 16:55
  • 1
    If you copy a file with cp -a or rsync --archive, you copy as much of the meta data as you can. The mtime will be copied too. The ctime is not however, because there is no way for cp or rsync to set it. See this article I wrote for more details. – Halfgaar Oct 15 '13 at 16:58
  • 1
    It's worth pointing out that change time is essentially the iNode modification time. – KeyC0de Jan 15 '18 at 16:35