Ctime: Difference between revisions
No edit summary |
m Minor editing and additions. |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
Time of last change of the [[inode]]. This time is taken from the [[inode]] itself. | 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 [[variables|$ | $ stat -s [[variables|$file]] | tr ' ' '\n' | grep ctime | ||
st_ctime=1130490970 | st_ctime=1130490970 | ||
$ date -r 1130490970 | $ date -r 1130490970 | ||
Fri Oct 28 11:16:10 CEST 2005 | Fri Oct 28 11:16:10 CEST 2005 | ||
$ ls -lcT | $ ls -lcT $file | ||
-rw-r--r-- 1 root wheel 33554432 Oct 28 11:16:10 2005 | -rw-r--r-- 1 root wheel 33554432 Oct 28 11:16:10 2005 file | ||
Usually when the [[mtime]] | 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 | $ find /path -ctime -2 -print | wc -l | ||
38 | 38 |
Latest revision as of 11:23, 27 January 2006
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