Ctime

From Hackepedia
Jump to navigationJump to search

Time of last change of the inode (e.g. permissions, ownership, etc). This time is taken from the inode itself. The ctime does not indicate the "creation time" of the file. Under some circumstances--specifically if the permissions and ownership in unchanged since the file was created--it may have the same value as the "creation time," but this is conincidence, and should not be relied upon.

$ stat -s $file | tr ' ' '\n' | grep ctime
st_ctime=1130490970
$ date -r 1130490970
Fri Oct 28 11:16:10 CEST 2005
$ ls -lcT $file
-rw-r--r--  1 root  wheel  33554432 Oct 28 11:16:10 2005 file

Usually when the mtime of a file is updated, the ctime will be updated as well. For example, when the size of a file is changed, this must be reflected in the metadata stored in the inode; thus, the ctime is updated appropriately.

Using the ctime value is also a good way to check for new files written or updated in your system in the last few days (2 in this example)

$ find /path -ctime -2 -print | wc -l
     38