47

Possible Duplicate:
How do I get the size of a Linux or Mac OS X directory from the command-line?

I am in a folder, and I want a list of all the sub-directories and their total sizes.

I dont' want it to list all the sub-directories and files in a recursive manner, just the top level directories and the total size it uses on my drive.

How can I do this?

user27449
  • 7,178

2 Answers2

99

With du you can compute the size of a directory:

du -hs dir

if you have only directories you can just (-h will return a human readable units, -s will not recurse)

du -hs *

if in the folder you have contains files and folders:

find . -maxdepth 1 -mindepth 1 -type d -exec du -hs {} \;

find will list all the directories (-type d) in the current folder (-mindepth 1 -maxdepth 1) and execute du on them.

Matteo
  • 8,097
  • 3
  • 47
  • 58
1

Try typing the following from inside the directory you're interested in

du

Works on unix so should work on mac

SwiftD
  • 528