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?
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?
The stat command may output this - (dash). I guess it depends on the filesystem you are using. stat calls it the "Birth time". On my ext4 fs it is empty, though.
%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: -
stat
command installed and I cannot add the stat
command to this environment? bash: stat: command not found
Commented
May 20, 2014 at 16:19
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.
cp -a
will create a new inode, which will have its ctime
the time the inode is created, but the same mtime
(which was in the past).
No, there is no such a command. In Unix creation time is not stored (only: access, modification and change).
ext4
filesystem is storing the file creation date.
Commented
Oct 29, 2019 at 15:28
sudo debugfs -R 'stat /path/to/file' /dev/sdaX
(replacesdaX
with the device name of the filesystem on which the file resides). The creation time is the value ofcrtime
. You can add| grep .[^ca]time
to list justmtime
(the modification time) andcrtime
(the creation time).ls
output thePossible Duplicate
also has an up-to-date answer that reflects our current systems' status.