loveneesh
26th February 2007, 13:19
Hi,

I want to know the unix command to get filename,complete date and time.

I am using ls -l command, but it give date like Feb 25 and I want complete date.

Any help would be highly appreciated,

Thanks

Han Brinkman
26th February 2007, 13:27
You can try the -T option, does that work on your server?

norwim
26th February 2007, 13:30
man ls reveals: (for instance)
ls -l --time-style=+%Y%d%m

hth

Norbert

loveneesh
26th February 2007, 13:37
Not it does not work

mr_suleyman
26th February 2007, 14:53
did you try ls -lc

Good luck !

loveneesh
26th February 2007, 16:53
no its not working, It gives date as Feb 25 while I want date with year also.

mark_h
26th February 2007, 21:38
I read somewhere that the best way to do this(if you are on something like solaris) is to write a perl script. That is all I know or recall.

victor_cleto
2nd March 2007, 12:34
Each UNIX implements small variation of each standard command and this can be acomplished of several ways.

On Linux you can use "ls --full-time" (equivalent to "ls -l --time-style=full-iso") to show thr date with full details:
2007-02-20 11:16:23.000000000 +0100
See your man page for ls.

If your ls does not provide such capabilities, maybe the date command does. On Linux you can get the full time of a file using "date --reference=<file>", for the above file would show: Tue Feb 20 11:16:23 CET 2007 (you can specify the format). I use this particularly to get the file date stamp in W3C UTC format, very handy.
See your man page for date.