# Macos – List directories and their sizes in Mac OS X command line

macos

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?

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.