up vote 0 down vote favorite
share [g+] share [fb]

What command do I use to find the size of all the files (recursively) in a Linux or Mac OS X directory?

link|improve this question

feedback

1 Answer

up vote 10 down vote accepted

Show the size of a single file

du -h path_to_a_file

Show the size of the contents of a directory, each sub-directory, and each individual file:

du -h path_to_a_directory

Show the size of the contents of a directory:

du -sh path_to_a_directory

link|improve this answer
7  
du -sch if you want something more easily readable. – Joey Aug 13 '09 at 20:09
@Johannes, I guess you should post this comment as an answer, so it can be accepted? – Arjan Aug 15 '09 at 17:15
I find the -c option redundant (at least on Mac OS X) and du -sh supresses the subtotals. – Daryl Spitzer Aug 17 '09 at 18:35
Aha, I didn't know one could accept one's own answer. Now at least people know the question is solved. – Arjan Aug 18 '09 at 9:41
I'll happily accept a new answer that is an improvement on mine. – Daryl Spitzer Aug 18 '09 at 16:10
feedback

Your Answer

 
or
required, but never shown

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