Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'd like to open Terminal.app and enter a command like:

my-macbook-pro:~ my-username$ ls -lh

Instead of seeing the size of the folders in bytes that are in my current working directory, I'd like to see size of the folders, including all of their contents like so:

drwxr-xr-x 7 my-username staff 100Gi Dec 20 19:38 my-huge-project-folder

drwxr-xr-x 3 my-username staff 80Gi Dec 27 14:15 my-slightly-smaller-project-folder

Is there a command I can type that will yield similar output above?

share|improve this question
add comment

1 Answer

up vote 15 down vote accepted

In order to see a list of folders with sizes you can use the du command.

To make the sizes human readable use the -h option

To make sum the size of child folders use the -s option (may take some time to run depending on the contents).

du -hs *

Here is an (uninteresting) example of the output.

   0B   Desktop
 632K   Documents
 356K   Downloads
  76M   Library
   0B   Movies
   0B   Music
 4.0K   Pictures
   0B   Public
  40K   Sites
share|improve this answer
    
Thank you! Worked perfectly. –  mkelley33 Jan 18 '11 at 17:25
    
@g you need more music… ;) –  Martín Marconcini Jan 18 '11 at 17:38
    
@martin - Or a faster computer... I ran it on a dummy account because I got impatient waiting for the results on my account! –  g . Jan 18 '11 at 18:21
3  
That will only count files you have access to read. Add sudo for a true count, especially if you are measuring outside your home folder. –  ridogi Jan 19 '11 at 4:50
2  
I like to add -c (du -shc *) to get a nice total at the end too. –  Darren Greaves May 31 '11 at 19:44
add comment

Your Answer

 
discard

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.