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?
 
sheetbirdCommented:
ls -Rl |sort -rk5|head
0
 
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..

0
 
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.