[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

solrais equivalent of ls -lSr

Posted on 2006-04-03
3
Medium Priority
?
287 Views
Last Modified: 2013-12-27
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
0
Comment
Question by:Peewee
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
sheetbird earned 200 total points
ID: 16364140
ls -Rl |sort -rk5|head
0
 
LVL 5

Author Comment

by:Peewee
ID: 16380621
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
 
LVL 3

Expert Comment

by:sheetbird
ID: 16392127
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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question