The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 11-25-2008 02:02 AM
list the files but exclude the files in subdirectories shyjuezy UNIX for Dummies Questions & Answers 8 10-15-2008 01:42 PM
Find all files created by a specified user in a directory and its subdirectories abhilashnair UNIX for Dummies Questions & Answers 5 06-13-2007 02:37 AM
find the 5o largest files in a directory igidttam Filesystems, Disks and Memory 8 05-16-2007 01:20 PM
searching files through all subdirectories beneath the current directory milagros Shell Programming and Scripting 5 05-15-2007 04:00 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-25-2006
igidttam igidttam is offline
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
  #2 (permalink)  
Old 09-25-2006
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
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
  #3 (permalink)  
Old 09-25-2006
igidttam igidttam is offline
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
  #4 (permalink)  
Old 09-25-2006
igidttam igidttam is offline
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
  #5 (permalink)  
Old 09-25-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
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
  #6 (permalink)  
Old 09-25-2006
igidttam igidttam is offline
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0