File created time

I have lot .log files in a directory.I need to take the one got created today.Is there any way to get the time of creation of a file?

Use "ls" with "-t" option.

time of creation of files in not stored in UNIX. you may use time of modification instead.

ls -ltr lists the most recently modified files at the bottom

-l long listing
-t sort by modification time
-r reverse the order of sorting

Assume we are creating file with modification times as,

touch -mt 200703231930.22 t4
touch -mt 200703232130.22 t3
touch -mt 200703231230.22 t1
touch -mt 200703201230.22 t2

Now Let us ensure the time stamp of the files,

ls -ltr t*
-rw-r-----   1 usera  groupa           0 Mar 20 12:30 t2
-rw-r-----   1 usera  groupa           0 Mar 23 12:30 t1
-rw-r-----   1 usera  groupa           0 Mar 23  2007 t4
-rw-r-----   1 usera  groupa           0 Mar 23  2007 t3

Now using the find command,as below u can list out the files modified within 1 day

find . -name '*' -mtime -1 -ls
  1498976    0 -rw-r-----   1 usera  groupa            0 Mar 23 12:30 ./t1
  1499624    0 -rw-r-----   1 usera  groupa            0 Mar 23  2007 ./t3
  1500510    0 -rw-r-----   1 usera  groupa            0 Mar 23  2007 ./t4

Please check if this works in your case.

Thanks
Nagarajan Ganesan.

Many thanks for your replies.I tried find but the problem is it will list all the files that got modified for the past one day.I want only files created on that particular day.Am doing a grep for date for that day to get it.Dont know it is good or bvetter ways are there.

Once again many thanks for your help

find /path/to/files -type f -mtime -1

list files in the directory /path/to/files that were last modified 23:59:59 and less, ie. the last day.

Unix does not track the creation date of files. For a good explanation, see Perderabo's thread: