Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How do I do a ls and then sort the results by date created?

Is there a command in Linux which displays when the file was created ? I see that ls -l gives the last modified time... but can I get the created time/date?

share|improve this question

migrated from stackoverflow.com Nov 11 '11 at 23:51

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Gilles, Michael Mrozek Nov 17 '11 at 21:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
Even while "OT" as this is asking for a tool to display this information, I think it's a valuable thing for programmers to know when dealing with more UNIX-y filesystems. – pst Nov 11 '11 at 23:20

The stat command may output this - I guess it depends on the filesystem you are using. stat calls it the "Birth time". On my ext4 fs though it is empty.

%w Time of file birth, human-readable; - if unknown

%W Time of file birth, seconds since Epoch; 0 if unknown

stat foo.txt
  File: `foo.txt'
  Size: 239             Blocks: 8          IO Block: 4096   regular file
Device: 900h/2304d      Inode: 121037111   Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/  adrian)   Gid: (  100/   users)
Access: 2011-10-26 13:57:15.000000000 -0600
Modify: 2011-10-26 13:57:15.000000000 -0600
Change: 2011-10-26 13:57:15.000000000 -0600
 Birth: -
share|improve this answer
1  
What if we do not have the stat command installed and I cannot add the stat command to this environment? bash: stat: command not found – javaPlease42 May 20 '14 at 16:19

No, there is no such a command. In Unix creation time is not stored (only: access, modification and change).

share|improve this answer
    
Not true in general. Some common filesystems used in Linux don't store creation time, but others do: see unix.stackexchange.com/questions/7562/… – LarsH Dec 18 '15 at 16:12

Linux offers three timestamps for files: time of last access of contents (atime), time of last modification of contents (mtime), and time of last modification of the inode (metadata, ctime). So, no, you cannot. The directory's mtime corresponds to the last file creation or deletion that happened, though.

share|improve this answer
4  
The file creation time is actually stored in Ext4, but not directly accessible. See unix.stackexchange.com/a/50184/8250 – Lekensteyn Feb 16 '13 at 10:02
    
There's a natural confusion between Linux OS, and the various filesystems that can be used with Linux. You can't just make general statements about Linux in regard to things specific to the filesystems. – LarsH Dec 18 '15 at 15:57