Listing the creation date/time of a file in unix | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Listing the creation date/time of a file in unix

Shell Programming and Scripting


Tags
mtime

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-14-2006
unipepper unipepper is offline
Registered User
 
Join Date: Feb 2006
Last Activity: 18 February 2013, 8:47 AM EST
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Question Listing the creation date/time of a file in unix

Hi,
I need the unix command which returns only the file name and its creation date/time in unix.

I tried ls -l <filename>. But that is giving other details also which I do not want.
Could anyone help me out?

Thanks.
Sponsored Links
    #2  
Old 02-14-2006
rahulrathod rahulrathod is offline
Registered User
 
Join Date: Sep 2004
Last Activity: 2 February 2010, 2:41 PM EST
Location: Mumbai-India
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
This might serve your purpose.

ls -lrt | tr -s " " | cut -d" " -f6-9

Rahul.
Sponsored Links
    #3  
Old 02-14-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
 
Join Date: Mar 2005
Last Activity: 5 July 2014, 11:14 AM EDT
Location: classification algos
Posts: 3,203
Thanks: 19
Thanked 30 Times in 27 Posts
Quote:
Originally Posted by rahulrathod
This might serve your purpose.

ls -lrt | tr -s " " | cut -d" " -f6-9

Rahul.
the time that is displayed is the modification time of the file

and i believe no where in the i-node file creation date/time would be stored
    #4  
Old 02-14-2006
rahulrathod rahulrathod is offline
Registered User
 
Join Date: Sep 2004
Last Activity: 2 February 2010, 2:41 PM EST
Location: Mumbai-India
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Agree with you.

But creation time should be stored somewhere i beleive as the find command can get the files created on/before/after a particular date. Curious to know where this info might be available.

Rahul.
Sponsored Links
    #5  
Old 02-15-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
 
Join Date: Mar 2005
Last Activity: 5 July 2014, 11:14 AM EDT
Location: classification algos
Posts: 3,203
Thanks: 19
Thanked 30 Times in 27 Posts
Quote:
Originally Posted by rahulrathod
Agree with you.

But creation time should be stored somewhere i beleive as the find command can get the files created on/before/after a particular date. Curious to know where this info might be available.

Rahul.
could you please let me know what is the option available in find to retrieve a file created before n days?

from the man pages of find with respect to time modification


Code:
-atime n
         True if the file was accessed n days ago.


Code:
-ctime n
        True if the file's status was changed n days ago.


Code:
 -mtime n
        True if the file's data was modified n days ago.

no where file creation date/time would be stored
Sponsored Links
    #6  
Old 02-15-2006
unipepper unipepper is offline
Registered User
 
Join Date: Feb 2006
Last Activity: 18 February 2013, 8:47 AM EST
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rahulrathod
This might serve your purpose.

ls -lrt | tr -s " " | cut -d" " -f6-9

Rahul.

This has helped. Thank you all for your support. Actually I wanted to access the modified date and time only.

I would anyhow find out whether it is possible to know the creation date and time of a file in unix and let you all know.

Thanks again.
Sponsored Links
    #7  
Old 02-15-2006
rahulrathod rahulrathod is offline
Registered User
 
Join Date: Sep 2004
Last Activity: 2 February 2010, 2:41 PM EST
Location: Mumbai-India
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
-ctime n
True if the file's status was changed n days ago.

Sorry,

I thought ctime was creation date. Just went by the name.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
listing file date and time without usage of pipe harish612 Shell Programming and Scripting 6 11-28-2011 04:54 AM
About Unix File creation time gaellafond UNIX for Dummies Questions & Answers 4 11-21-2011 11:02 AM
Unix File creation time tinivt Shell Programming and Scripting 2 01-23-2007 05:27 AM
Changing Creation Date to a Prespecified Date of a File In Unix monkfan UNIX for Dummies Questions & Answers 4 11-28-2006 06:15 AM
file creation date & time alisevA3 UNIX for Dummies Questions & Answers 3 07-08-2005 05:21 AM



All times are GMT -4. The time now is 07:09 PM.