I want to find out the creation date of particular file, not modification date or access date.
I have tried with
ls -ltrh and
The POSIX standard only defines three distinct timestamps to be stored for each file: the time of last data access, the time of last data modification, and the time the file status last changed.
That said, modern Linux filesystems, such as ext4, Btrfs and JFS, do store the file creation time (aka birth time), but use different names for the field in question (
As Craig Sanders and Mohsen Pahlevanzadeh pointed out,
As Stephane Chazelas points out, some filesystems, such as ntfs-3g, expose the file creation times via extended file attributes.
You can extract the ext4 creation times on Fedora 19 systems. Here's mine:
It's clear that the inodes on my ext4 partitions have the creation time. Here's a shell script that determines the inode associated with a filename and then augments the
NB: This is just a demo and hugely inefficient since a kernel module is created, loaded, and unloaded for every execution. This is also probably very fragile as no error checking is performed. A proper kernel API would be preferable, but this script could be made much more efficient and read the creation times of multiple files/inodes.
[contents of stap_stat.sh]
Here's a demo:
In theory, with GNU stat you could use
In practice, most filesystems do not record that information and the linux kernel does not provide any way of accessing it.
The closest you can get is the file's ctime, which is not the creation time, it is the time that the file's metadata was last changed.
Linux Weekly News had an interesting article about this a few years back - http://lwn.net/Articles/397442/
If you call
In OS X you can use