Unix - File Creation Date
For an assignment I need to dete开发者_开发问答rmine the creation time of a random file. As far as I know, Unix does not store the creation time (in contrast to *-BSD). I think I've read somewhere that you should ask for the modification time instead but I don't know where and asking Google doesn't give me a non-ambigious answser either.
Any ideas?
You cannot get the creation time of files in this context. That makes the assignment easy enough: it reasonably cannot be completed.
If someone is talking about creation time in Unix, they are confused. Modification time is completely different from creation time (obviously).
For the record, there are exactly three timestamps in Unix files: ctime, atime and mtime.
Try stat
. It will give you all the times associated with a file.
stat filename
To get just the modification date and time:
stat --format=%y filename
Or in seconds since the Epoch:
stat --format=%Y filename
精彩评论