Unix uses three attributes for file time stamps. The time the file was last accessed (atime) and the time the file was last modified (mtime) and the time the file last had an attribute changed (ctime). These attributes can be used by many Unix programs to describe the sort of files your looking for. Here's an example of how they work:

First we create the file and look at the time stamps, you can see they are all in sync:

# touch test 

# stat test | tail -4
Access: Thu Sep 18 15:21:44 2003
Modify: Thu Sep 18 15:21:44 2003
Change: Thu Sep 18 15:21:44 2003

The we update the mtime and ctime by writing to the file:

# echo FOO >> test 

# stat test | tail -4
Access: Thu Sep 18 15:21:44 2003
Modify: Thu Sep 18 15:22:47 2003
Change: Thu Sep 18 15:22:47 2003

Now update the atime by reading the file:

# cat test 
FOO

# stat test | tail -4
Access: Thu Sep 18 15:22:56 2003
Modify: Thu Sep 18 15:22:47 2003
Change: Thu Sep 18 15:22:47 2003

Now we update only the ctime by chmod'ing the file:

# chmod 755 test 

# stat test | tail -4
Access: Thu Sep 18 15:22:56 2003
Modify: Thu Sep 18 15:22:47 2003
Change: Thu Sep 18 15:23:18 2003


CategoryWriting

UnixTimeStamps (last edited 2003-09-18 03:30:16 by AdamShand)