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?

  • 2
    Why the down votes?
    – Matteo
    Jan 27, 2013 at 17:09
  • @Matteo I'd say that this question does not show research effort. In fact, the Related list shows the question which is essentially a duplicate, which means the OP should have seen it when they were searching for an answer to their question before they posted it.
    – slhck
    Jan 27, 2013 at 17:14
  • @slhck I agree but I was more hinting that a down vote should be commented (or the question flagged).
    – Matteo
    Jan 27, 2013 at 21:01
  • 1
    @slhck I'm doing "research effort" right now just came across this page as most prominent Google hit. What does that say about your comment?
    – geotheory
    Feb 1, 2015 at 13:42
  • 1
    Hi. I'm not commenting on down-voting. It's more a generic observation (probably belonging in meta) that I've solved innumerable problems using SO/SE pages that feature comments to the effect of 'should've checked google'..
    – geotheory
    Feb 1, 2015 at 15:25

2 Answers 2


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.

  • FYI - As is this command generates a warning: find: warning: you have specified the -mindepth option after a non-option argument -type, but options are not positional (-mindepth affects tests specified before it as well as those specified after it). Please specify options before other arguments. Solution: find . -maxdepth 1 -mindepth 1 -type d -exec du -hs {} \;
    – Bisonbleu
    Jul 10, 2019 at 14:27
  • @Bisonbleu Thanks, I edited the answer. BTW I don't get any warning on High Sierra.
    – Matteo
    Jul 20, 2019 at 15:54
  • For the record, I'm on Mojave 10.14.5
    – Bisonbleu
    Jul 21, 2019 at 16:30
  • @Matteo How to sort the result?
    – Dr.jacky
    Oct 27, 2021 at 15:24
  • 2
    @Dr.jacky Remove the -h option to du (size in bytes) and pipe the result to sort. E.g, du -s * | sort -n
    – Matteo
    Oct 29, 2021 at 6:40

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


Works on unix so should work on mac

  • 1
    Yes but it lists all the files and folders seperately, I just want the folder sizes (totals).
    – user27449
    Jan 27, 2013 at 18:52

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