How to find time | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

How to find time

UNIX for Dummies Questions & Answers


Tags
linux, mtime

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-24-2006
dakid dakid is offline
Registered User
 
Join Date: May 2006
Last Activity: 13 July 2010, 12:24 PM EDT
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
How to find time

Help me with this please...

If i am entering command ls -l, here is what it gives:

-rw-r----- 1 user22 psa 2140 Dec 2 2005 summary.gz

anyone knows how can i know the time it was last modified?
Sponsored Links
    #2  
Old 09-24-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 29 July 2014, 2:02 PM EDT
Location: NM
Posts: 10,156
Thanks: 269
Thanked 781 Times in 731 Posts
If you are on Linux

Code:
date -r summary.gz

Otherwise, search the fourm for this topic.
Sponsored Links
    #3  
Old 09-24-2006
dakid dakid is offline
Registered User
 
Join Date: May 2006
Last Activity: 13 July 2010, 12:24 PM EDT
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Can you help me searching for it??
i cant find it in the forum. thanks
    #4  
Old 09-24-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
AFK
 
Join Date: Dec 2004
Last Activity: 28 July 2014, 9:39 AM EDT
Location: UK
Posts: 2,351
Thanks: 0
Thanked 6 Times in 6 Posts
dakid,
Could you take a look at the man page of ls?

Code:
     -l    Lists in long format,  giving  mode,  ACL  indication,
           number of links, owner, group, size in bytes, and time
           of last modification for each file

What you are seeing is the time the file was last modified.
Sponsored Links
    #5  
Old 09-24-2006
dakid dakid is offline
Registered User
 
Join Date: May 2006
Last Activity: 13 July 2010, 12:24 PM EDT
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
blowtorch,

i have an archive directory which when the file is too old, when im viewing the files in long format, the field for time is replaced by the year.
i want to know if there is a command to know when a specific file was last modified because i cant see it useing the ls -l command.
Sponsored Links
    #6  
Old 09-24-2006
nathan nathan is offline VIP Member  
Supporter
 
Join Date: Jul 2006
Last Activity: 15 February 2012, 11:03 AM EST
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
If you have perl ... .

Code:
$ ll todo.txt
-rw-r--r--  1 root root 502 Mar  7  2006 todo.txt
perl -e "use File::stat; \
  \$st=stat(\"todo.txt\"); \
   printf(\"%s\\n\",scalar(localtime(\$st->atime))); \
"
Thu Apr  6 00:57:39 2006

Change "atime" to "mtime" above for the last modification time. Change it to "ctime" for the last inode change time ( for example, if owner/group or permissions changed ). "atime" is last access time.

Get a man on "stat" for more info.

Last edited by nathan; 09-24-2006 at 11:21 PM.. Reason: clarify
Sponsored Links
    #7  
Old 09-24-2006
dakid dakid is offline
Registered User
 
Join Date: May 2006
Last Activity: 13 July 2010, 12:24 PM EDT
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
what if i dont have perl?
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
what would a script include to find CPU's %system time high and user time high? sushwey Shell Programming and Scripting 9 04-26-2012 11:44 AM
/dev/tty find last modified time l flipboi l UNIX for Dummies Questions & Answers 4 02-14-2011 03:12 PM
Find and Convert UTC Time to PST Time drexnefex Shell Programming and Scripting 0 07-26-2010 07:49 PM
find files by time rein Solaris 3 02-13-2008 07:11 AM
Can any how we can find the time diffrence...? Amey Joshi UNIX for Dummies Questions & Answers 1 10-26-2007 10:20 AM



All times are GMT -4. The time now is 02:50 PM.