This issue has plagued me for awhile, but I never figured out the command to actually have unix print out the size of an entire directory. I came across the need handfuls of times over the years, but today I finally needed to actually learn this one.
So a bit of research led me to the following command:
dir1 dir2 dir3
steve$ du -sh dir1
2.4M dir1
Finally I can get the full file size of an entire directory via a shell. Hopefully I’ll remember that I posted this so message, for the next time I forget about this command.
By the way, about the arguments above: -s tells the shell I want size, and -h tells it I want it human readable.

Dan Herman
2008.11.13
Actually the -s tells du you want to see entries for just the specified directories, rather than for all subdirectories. It’s equivalent to specifying a depth of zero (-d 0). See “man du”
Steve
2008.11.13
Thanks for the correction, Dan.
Hakiem
2009.07.21
Great tutorial. Very straight forward. I ve been looking for this for long time. Thanks!
Roe Lee
2009.07.23
Simple tuts but useful. Thanks sir.
Mayank Pandya
2010.04.15
That is a very helpful tip.
Thanks!
Andrew
2010.05.12
-h option only on Linux and not HP Unix.
zslee
2010.05.31
thanks, simple and usefull
Maram
2011.08.15
well …. I think its du -sk dir1 not du -sh.. coz I test
Steve Jamesson
2011.08.15
Run
Seshu
2011.09.20
du =-s using this function we can get folder size as well as subfolders size
seshu
2011.09.20
du -sk return the result in KB du -sh return the result in MB