file creation date

James Wilkinson james at westexe.demon.co.uk
Tue Sep 14 16:42:31 UTC 2004


Michael Griffin wrote:
> How do I display/retrieve the date a file was created (using bash
> shell)?

You don't: not portably across filesystem types, anyway. Sorry.

There are three times kept in a Unix-type filesystem: the access time
(atime: when someone last "read" the file's contents), the modification
time (mtime, the last time someone wrote to the file's contents), and
the status change time (ctime, when someone last changed things like
permissions or filename: the "meta-data" stored by the filesystem
about the file).

You use ls -l for the modification time, ls -lu for the access time,
and ls -lc for the status time.

File creation date is not recorded. It may be the same as the mtime or
the ctime, or it may not.

Having said all that, some non-native filesystems supported by Linux
keep this data. I'm not aware of any way of getting it, though.

James.

-- 
E-mail address: james | "The US Air Force is removing harmful "greenhouse"
@westexe.demon.co.uk  | gases from the cooling systems of intercontinental
                      | ballistic missiles. This will minimise damage to the
                      | ozone layer in the event of a nuclear holocaust."
                      |     -- The Guardian.





More information about the fedora-list mailing list