View Single Post
Old 01-15-2018, 04:23 PM   #9
sjfan
Addict
sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.
 
Posts: 281
Karma: 7724454
Join Date: Sep 2017
Location: Bethesda, MD, USA
Device: Kobo Aura H20, Kobo Clara HD
Quote:
Originally Posted by haertig View Post
Of course they do. They store ctime, mtime and atime (creation time, last modification time, last access time). The creation time is the time when the file was created on your system, unless you specified to use the creation time from the original computer you imported the file from.
ctime is not file creation time—that’s a common mistake made by new Unix users.

ctime is the inode change time. Any change to the inode info will update the ctime, even if the file remains unchanged. For instance, a chown or chmod on a file updates the ctime.

Code:
$ echo "Test" > test.txt
$ ls -clt test.txt    # File was created at 16:20
-rw-rw-r-- 1 user group 5 Jan 15 16:20 test.txt
$ chmod g-w test.txt    # Change permissions at 16:21
$ ls -clt test.txt     # File was still created at 16:20, but ctime tracks the inode change not the creation time
-rw-r--r-- 1 user group 5 Jan 15 16:21 test.txt
$ cat test.txt      # File is unchanged; still the same one created at 16:20
Test
sjfan is offline   Reply With Quote