solrais equivalent of ls -lSr

what is the solaris equivalent of ls -lSr

basically i want to:
list files in the current directory by size
list the 10 biggest files in the current directory and in all sub directories.

thx Peewee
LVL 5
PeeweeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sheetbirdCommented:
ls -Rl |sort -rk5|head

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PeeweeAuthor Commented:
hi sheetbird,
thanks for your answer it does what i'm after.. how do i get the path name of the file to display aswell as the file name..

sheetbirdCommented:
getting the path with ls is not possible.  I would suggest that you use a perl script.  Here's a quick hack of another script I wrote that will get the file name and the size

#!/usr/bin/perl
use Cwd;
use File::Find;
sub process_file {
($size) = (stat($_))[7];
        my $path = cwd;
        print "$size $path\/$_ \n";
}
if (!$ARGV[0]){
        die "I need a Directoy as input \n";
}
find(\&process_file, @ARGV);


Save it as getfilesize.pl and then you can pipe it to sort as done above

./getfilesize.pl <targetdir> | sort -nr|head

The whole thing can be done in perl but I didn't want to spend the time on it if perl is something you don't want to do.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.