12

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?

25

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
  • @g you need more music… ;) – Martin 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
  • 3
    I like to add -c (du -shc *) to get a nice total at the end too. – Darren Greaves May 31 '11 at 19:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .