The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to remove directory with subdirectories and files? ppa108 UNIX for Dummies Questions & Answers 9 1 Week Ago 11:02 PM
list the files but exclude the files in subdirectories shyjuezy UNIX for Dummies Questions & Answers 8 10-15-2008 10:42 AM
Find all files created by a specified user in a directory and its subdirectories abhilashnair UNIX for Dummies Questions & Answers 5 06-12-2007 11:37 PM
find the 5o largest files in a directory igidttam Filesystems, Disks and Memory 8 05-16-2007 10:20 AM
searching files through all subdirectories beneath the current directory milagros Shell Programming and Scripting 5 05-15-2007 01:00 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-25-2006
Registered User
 

Join Date: Sep 2005
Posts: 22
list largest files in a directory & its subdirectories

I need to find the largest files in a directory & it's subdirectories.
I'm not sure what options on ls -l will work to give me this. or is there another way to do this?
Thanks,
igidttam
Reply With Quote
Forum Sponsor
  #2  
Old 09-25-2006
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
For example, to show the 10 largest files under /somedir and it's subdirectories:

Code:
find /somedir -type f -print | xargs ls -l | sort -k5,5rn | head
Cheers
ZB
Reply With Quote
  #3  
Old 09-25-2006
Registered User
 

Join Date: Sep 2005
Posts: 22
ZB

I'm getting an error. xargs| Child killed with signal 13.
How would I get around this?
Thakn You for your help!
igidttam
Reply With Quote
  #4  
Old 09-25-2006
Registered User
 

Join Date: Sep 2005
Posts: 22
I changed the code a little to this
find /cep -type f -print | ls -l | head
It worked, but not sure I have all the files in the subdirectories.
Can someone help me here?

Thanks
igidttam
Reply With Quote
  #5  
Old 09-25-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
if you know what files are supposed to be there and /cep is the directory off of the root directory / you want to search
Code:
find /cep -type f -print
will show you all the files you are looking at

Code:
cd /home
find . -type f -print | ls -l -s | sort -n | tail
does in fact give me the biggest files. You would use
Code:
cd /cep
Reply With Quote
  #6  
Old 09-25-2006
Registered User
 

Join Date: Sep 2005
Posts: 22
Thanks Jim! This works, but only gives me the largest files in that directory [in my example the /cep directory]. I'm also looking for the largest files within each of the subdirectories of that directory. For example, I want the 10 largest files of some directory and the 10 largest files of each subdirectory under that directory. How do I do that?

Thanks,
igidttam
Reply With Quote
  #7  
Old 09-25-2006
Registered User
 

Join Date: Sep 2005
Posts: 22
I go t it to work. I needed the ls -lR.

Thanks Jim
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:41 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0