Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How to know the size of a directory? Including subdirectories and files.

share|improve this question

3 Answers 3

up vote 53 down vote accepted
du -s directory_name

Or to get human readable output:

du -sh directory_name

The -s option means that it won't list the size for each subdirectory, only the total size.

share|improve this answer
Actually du's default unit is 512-byte blocks according to POSIX, and kilobytes on Linux (unless the environment variable POSIXLY_CORRECT is set) or with du -k. –  Gilles Oct 12 '10 at 17:49
@Gilles: Good catch. I've removed the "number of bytes" bit from my answer. –  sepp2k Oct 12 '10 at 17:53

du takes a -b option

See the man page and the info page for more help:

-b, --bytes
          equivalent to '--apparent-size --block-size=1'
share|improve this answer

you can also use ls -ldh:

ls -ldh /etc drwxr-xr-x 145 root root 12K 2012-06-02 11:44 /etc

-l is for long listing ; -d is for displaying dir info, not the content of the dir, -h is for displaying size in huma readable format.

share|improve this answer
This isn't correct, the person asking is clearly looking for footprint of a directory and it's contents on disk. @sepp2k's answer is correct. –  blong Jun 5 '12 at 13:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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