Is there any way to show timestamp instead of date in "ls 僕" | 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.

Is there any way to show timestamp instead of date in "ls 僕"

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-19-2006
umen umen is offline
Registered User
 
Join Date: Aug 2005
Last Activity: 21 July 2014, 10:21 AM EDT
Posts: 261
Thanks: 0
Thanked 0 Times in 0 Posts
Is there any way to show timestamp instead of date in "ls 僕"

Hello
is there any way build in by unix native commands to show timestamp instead of date when I do "ls 僕" ?
if not is there any one liner script to do this?
thanks
Sponsored Links
    #2  
Old 02-19-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
Do you want to show the time a file was modified instead of the date? Excerpt from the man page of ls
Quote:
If the time of last modification is greater than six months ago, it is shown in the format `month date year' for the POSIX locale. When the LC_TIME locale category is not set to the POSIX locale, a different format of the time field may be used. Files modified within six months show `month date time'.
As for a simple one liner, I can give you a simple two liner:

Code:
#!/usr/bin/perl -w #-d
$mtime=(stat($ARGV[0]))[9]; @ltime=localtime $mtime; printf "%.4d-%.2d-%.2d-%.2d-%.2d\n",$ltime[5]+1900,$ltime[4]+1,$ltime[3],$ltime[2],$ltime[1];

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
awk command to replace ";" with "|" and ""|" at diferent places in line of file shis100 Shell Programming and Scripting 7 03-16-2011 08:59 AM
show dots when script is "thinking" pkohn11 Shell Programming and Scripting 10 05-07-2010 04:51 PM
HowTo: reg expr doing grep "timestamp>$DesiredTime" logfile ? Browser_ice Shell Programming and Scripting 5 07-05-2009 02:17 PM
add seconds to: date"|"time"|"HHMMSS anaconga UNIX for Advanced & Expert Users 3 08-27-2008 01:17 PM



All times are GMT -4. The time now is 08:23 PM.