cancel
Showing results for 
Search instead for 
Did you mean: 

command needed - part 2

SOLVED
Go to solution
ng_7
Regular Advisor

command needed - part 2

hi, please provide me command below :

to list file sorted by modified date. the most recent on top. i try to use ll -tr *.t
but it shows the oldest on top.

thank you very much

Regards
ng
10 REPLIES
Patrick Wallek
Honored Contributor
Solution

Re: command needed - part 2

Ummmm.......Well, if you consider that the 'r' switch means 'reverse'....Think about it.

# ll -t *.t

# man ls
will give you all the options available to you.
skt_skt
Honored Contributor

Re: command needed - part 2

ls -lrt|sort -n
ls -lrt|sort -nr
Dennis Handly
Acclaimed Contributor

Re: command needed - part 2

>Santhosh: ls -lrt|sort -n

This is not apt to work unless the permissions are numeric. You of course can sort on the size field with -k5,5
ng_7
Regular Advisor

Re: command needed - part 2

hi, please look at the output below, the modified date still not sorted by newest on top. thanks

-rw-rw-rw- 1 applprod dba 60710012 May 23 01:52 OFABAa25903.t
-rw-rw-rw- 1 applprod dba 60710012 May 23 01:47 OFKCAa25908.t
-rw-rw-rw- 1 applprod dba 4107657 Feb 24 16:36 OFRAAa22401.t
-rw-rw-rw- 1 applprod dba 2758721 Mar 24 15:43 OFQAAa04472.t
-rw-rw-rw- 1 applprod dba 2676846 Mar 2 15:08 OFYBAa03238.t
-rw-rw-rw- 1 applprod dba 2665762 Feb 27 20:29 OFQAAa03313.t
-rw-rw-rw- 1 applprod dba 2192103 Mar 2 16:26 OFZBAa12621.t
-rw-rw-rw- 1 applprod dba 1794439 Mar 18 16:07 OFPBAa18593.t
-rw-rw-rw- 1 applprod dba 1682356 Jun 6 08:21 OFBAAa09498.t
-rw-rw-rw- 1 applprod dba 1655439 Mar 24 17:15 OFRBAa04477.t
-rw-rw-rw- 1 applprod dba 1528237 Apr 28 15:54 OFWAAa03244.t
MarkSyder
Honored Contributor

Re: command needed - part 2

What command did you use to produce this output? ll -t will sort by time order, ll -tr by reversed time order. Your output is not sorted by either, which suggests you did not use a t switch.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Dennis Handly
Acclaimed Contributor

Re: command needed - part 2

>Mark: Your output is not sorted by either,

It looks like it was: ?
$ ll | sort -nr -k5,5
MarkSyder
Honored Contributor

Re: command needed - part 2

Dennis,

Your command sorts by size, not time.

Mark
The triumph of evil requires only that good men do nothing
Dennis Handly
Acclaimed Contributor

Re: command needed - part 2

>Mark: Your command sorts by size, not time.

Of course. I first said that sort -n won't work. Then said -n -k5,5 would sort on size.

Then when ng produced that weird output, I suggested that was the mistake.

Getting back to the original question, as everyone has said, use: "ll -t"
Yogeeraj_1
Honored Contributor

Re: command needed - part 2

hi ng,

ll -t

this works fine!

e.g.
$ ll -t |head
total 88400
-rw-r--r-- 1 oracle oinstall 298 Jun 8 16:00 count_sessions.lis
-rw------- 1 oracle oinstall 2105344 Jun 8 15:23 opm_sys_shm.mem
-rwxr-xr-x 1 oracle oinstall 0 Jun 8 15:15 opm_sys_mtx.1181301311
-rw------- 1 oracle oinstall 0 Jun 8 15:15 opm_sys_shm.sem
-rw-r--r-- 1 oracle oinstall 44360107 May 22 14:39 UDUMP.TAR.Z
-rw-r--r-- 1 oracle oinstall 226782 May 21 13:19 listbackup20070521.txt
-rw-rw-rw- 1 root sys 9498 Apr 16 10:26 crontab.txt
-rw-rw-rw- 1 root sys 11278 Apr 12 15:06 print_manifest.slx2.txt
-rw-r--r-- 1 oracle oinstall 2285 Apr 12 11:56 mystack
$


kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
ng_7
Regular Advisor

Re: command needed - part 2

Thanks to everyone for all your time to answer my question. I managed to solved it using ll *.t