Click to See Complete Forum and Search --> : ls command


Manuel-H
07-09-2004, 01:50 AM
How do I get ls to display the date as full date (2004-06-04) instead of "Jul 7"?

On my new Slackware 10.0 fresh install box:-
-rw-r--r-- 1 root root 680 2004-06-04 10:19 hosts

On my upgraded box v9.1 to 10.0
-rw-r--r-- 1 root root 662 Jul 7 15:34 hosts

I have checked both ls and the options are the same.
# ls is aliased to `/bin/ls $LS_OPTIONS'
# echo $LS_OPTIONS
--color=auto -F -b -T 0

mrBen
07-09-2004, 06:08 AM
ls --full-time

Manuel-H
07-09-2004, 07:47 AM
--full-time switch gave me this output which is not really nice compare to the original

Original
******
-rw-r--r-- 1 root root 680 2004-06-04 10:19 hosts

ls --full-time
**********
drwxr-xr-x 2 root bin 4096 2004-07-08 03:49:17.000000000 +0800 bin/

I believed there must be some switch or something that I am missing.
Not really important but it aroused my curiousity to find it out.

mrBen
07-09-2004, 09:41 AM
OK - in that case use ls -l --time-style=long-iso




mrben@hobbes:/$ ls -al --time-style=long-iso
total 69
drwxr-xr-x 25 root root 664 2004-07-08 16:05 .
drwxr-xr-x 25 root root 664 2004-07-08 16:05 ..
drwxr-xr-x 11 root root 39064 2004-07-06 12:00 .dev
drwxr-xr-x 2 root root 48 2004-06-11 07:49 .mozilla
drwxr-xr-x 2 root root 2152 2004-07-08 16:05 bin
drwxr-xr-x 3 root root 1024 2004-06-17 16:15 boot
drwxr-xr-x 2 root root 48 2004-06-10 22:29 cdrom
drwxr-xr-x 7 root root 3180 2004-07-09 09:13 dev
drwxr-xr-x 130 root root 7296 2004-07-09 10:30 etc
drwxr-xr-x 2 root root 48 2004-06-10 22:29 floppy
.......



(FYI man ls was where all my info is coming from.......)

Manuel-H
07-09-2004, 11:00 AM
Yes, that's it.

Honestly, I went thru the 'man ls' before I wrote the msg and I didn't see it there. Even now, I did a 'man ls' again and did not see it either.

GNU options (shortest form): [-1abcdfghiklmnopqrstuvwxABCDFGHLNQRSUX] [-w cols] [-T cols] [-I pattern] [--full-time]
[--show-control-chars] [--block-size=size] [--format={long,verbose,commas,across,vertical,single-column}]
[--sort={none,time,size,extension}] [--time={atime,access,use,ctime,status}] [--color[={none,auto,always}]] [--help]
[--version] [--]

I am using Slackware 10.0 and ls (coreutils) 5.2.1.

Now bring me to the question on why a fresh install of Slackware 10.0 show the full date or ISO date whereas upgraded from 9.1 will not show. Still curious on where I should be looking for to change it.

mrBen
07-09-2004, 11:27 AM
From the look of your first post, you should just change the $LS_OPTIONS variable.

Icarus
07-09-2004, 11:35 AM
Originally posted by mrBen
(FYI man ls was where all my info is coming from.......) Ben, you cheater :D
Some of use don't have the luxury of typing "man ls" all the time, and need to rely on the limited power of http://google.com/linux :D
(Which also happens to find the man pages, for several OSes even...never mind I'll go back to work now)