In Linux or any Unix flavors, file-creation time isn't maintained. It will get change when the file-content changes. I tested and confirmed this 1.5 years before and shared my test results in this post.
http://ashok-linux-tips.blogspot.com/2010/11/finding-file-creation-time-in-linux.html
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 3.8G 2.2G 1.4G 62% /
/dev/sda3 4.6G 139M 4.3G 4% /home
/dev/sda1 46M 11M 33M 25% /boot
tmpfs 333M 0 333M 0% /dev/shm
root@Linux-Mach # cd /opt
root@Linux-Mach # touch sample_file
root@Linux-Mach # ls -l sample_file
-rw-r--r-- 1 root root 0 2012-04-24 18:35 sample_file # File-creation time is 18:35
root@Linux-Mach # date
Tue Apr 24 18:40:12 CDT 2012
root@Linux-Mach # cat > sample_file
This is test file to check creation time of this file.
Ctrl+D
root@Linux-Mach # ls -l sample_file
-rw-r--r-- 1 root root 29 2012-04-24 18:40 sample_file
root@Linux-Mach # ls -i sample_file
135528 sample_file # inode number
root@Linux-Mach # debugfs -R 'stat <135528>' /dev/sda2
Inode 14552801 Type regular Mode 0644 Flags 0x80000
Generation 340511001 Version 0x0000000000000001
User 1000 Group 1000 Size 29
File ACL 0 Directory ACL 0
Links 1 Blockcount 8
Fragment Address 0 Number 0 Size 0
ctime 0x3f1da5b513cbff4 -- Tue Apr 24 18:40:51 2012
atime 0x3f1da5ec8725434 -- Tue Apr 24 18:40:54 2012
mtime 0x3f1da5b513cbff4 -- Tue Apr 24 18:40:51 2012
crtime 0x3f1cacc966104fc -- Tue Apr 24 18:35:28 2012 # we could see file creation time
Size of extra inode fields 28
EXTENTS
(0) 44665199
debugfs 1.41.11 (14-Mar-2010)
http://ashok-linux-tips.blogspot.com/2010/11/finding-file-creation-time-in-linux.html
Now the good news is, with 'EXT4' file-system it is possible to get the File-creation time.
Here's the test results performed on a EXT4 file-system:
root@Linux-Mach # df -hFilesystem Size Used Avail Use% Mounted on
/dev/sda2 3.8G 2.2G 1.4G 62% /
/dev/sda3 4.6G 139M 4.3G 4% /home
/dev/sda1 46M 11M 33M 25% /boot
tmpfs 333M 0 333M 0% /dev/shm
root@Linux-Mach # cd /opt
root@Linux-Mach # touch sample_file
root@Linux-Mach # ls -l sample_file
-rw-r--r-- 1 root root 0 2012-04-24 18:35 sample_file # File-creation time is 18:35
root@Linux-Mach # date
Tue Apr 24 18:40:12 CDT 2012
root@Linux-Mach # cat > sample_file
This is test file to check creation time of this file.
Ctrl+D
root@Linux-Mach # ls -l sample_file
-rw-r--r-- 1 root root 29 2012-04-24 18:40 sample_file
root@Linux-Mach # ls -i sample_file
135528 sample_file # inode number
root@Linux-Mach # debugfs -R 'stat <135528>' /dev/sda2
Inode 14552801 Type regular Mode 0644 Flags 0x80000
Generation 340511001 Version 0x0000000000000001
User 1000 Group 1000 Size 29
File ACL 0 Directory ACL 0
Links 1 Blockcount 8
Fragment Address 0 Number 0 Size 0
ctime 0x3f1da5b513cbff4 -- Tue Apr 24 18:40:51 2012
atime 0x3f1da5ec8725434 -- Tue Apr 24 18:40:54 2012
mtime 0x3f1da5b513cbff4 -- Tue Apr 24 18:40:51 2012
crtime 0x3f1cacc966104fc -- Tue Apr 24 18:35:28 2012 # we could see file creation time
Size of extra inode fields 28
EXTENTS
(0) 44665199
debugfs 1.41.11 (14-Mar-2010)
root@Linux-Mach #
Please note the entry "crtime" which displays the file-creation time. In my view, this information would be of great help in certain situations.
Please note the entry "crtime" which displays the file-creation time. In my view, this information would be of great help in certain situations.