Is this possible, and what would the command be?

link|improve this question

62% accept rate
1  
Do you mean like, all directories (regardless of at what depth)? Do you mean containing 10mb in the directory itself, or 10 mb in the directory or any subdirectory? Also, I think it's a better fit to post it on superuser – roe Oct 27 '09 at 14:55
Why superuser? This seems like a sysadmin task, and so if it belongs anywhere really belongs on ServerFault. – APC Oct 27 '09 at 14:58
all directories at any depth, and the the total file size next to each directory would include it's sub directories. – kylex Oct 27 '09 at 15:00
feedback

migrated from stackoverflow.com Oct 27 '09 at 15:25

This question came from our site for professional and enthusiast programmers.

4 Answers

up vote 5 down vote accepted

du is the easiest way. Grab the directories of interest with perl.

du -m . | perl -ne '@l = split();print "@l\n" if $l[0]>=10'
link|improve this answer
+1 I like that you're just reporting what the question asks for – DaveParillo Oct 27 '09 at 16:31
feedback
du -k /<root-of-interest> | sort -n 

Then look at the tail for the large directories. You want all that are report greater than 10000.

link|improve this answer
du is the way to go. du|xdu makes it more visibile too.. – roe Oct 27 '09 at 14:57
I might type "du --max-depth=1 | sort -g | less" but that's just a personal preference. Of course the "max-depth" flag only exists in GNU du. – CarlF Oct 27 '09 at 15:45
feedback

Do like this:

find {/path/to/directory} -type f -size +{file-size-in-kb}k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

Remember to don“t put the {}'s.

In your case do like this:

find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
link|improve this answer
2  
this finds files, not directories – roe Oct 27 '09 at 14:56
Ops, sorry, i didn't see. Sorry! – Nathan Campos Oct 27 '09 at 14:58
feedback

The du answers above are closer to what you want, but you might also want to try out kdirstat. Its a cool gui tool that shows all your dirs, what's in them, what the content is, and has various tools to delete or move files. There's even Windows (WindDirStat) and MacOSX (Disk Inventory X) clones.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.