What counts as a file modification or change

filestimestamps

Does renaming affect the file modify or access time? Is there a list somewhere of what changes which times?

Best Answer

Renaming does update the Change time:

$ mkdir tmp
$ cd tmp

$ echo abc > a
$ stat a
  File: `a'
  Size: 4               Blocks: 8          IO Block: 4096   regular file
Device: 26h/38d Inode: 5038682     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000 /  zelda   Gid: ( 1000/   zelda)
Access: 2013-12-12 07:06:58.981107444 +0100
Modify: 2013-12-12 07:06:58.981107444 +0100
Change: 2013-12-12 07:06:58.981107444 +0100
 Birth: -

$ mv a b
$ stat b
  File: `b'
  Size: 4               Blocks: 8          IO Block: 4096   regular file
Device: 26h/38d Inode: 5038682     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/  zelda)   Gid: ( 1000/   zelda)
Access: 2013-12-12 07:06:58.981107444 +0100
Modify: 2013-12-12 07:06:58.981107444 +0100
Change: 2013-12-12 07:07:14.893238472 +0100
 Birth: -

The Access time is updated when reading the contents of a file. Modify when you actually update the file (opening for modification is not enough to change Modify time).

Related Question