How to list directory size of all child directories?

The simplest is:

du -h --max-depth=1 parent

This will show all sizes of the children of parent If you also want the grandchildren, you can do

du -h --max-depth=2 parent

If you want the whole family

du -h parent

All these will just summarize the total directory size of each subdirectory up to a given level (except the last, it will give for all)

If you don't want the content of the subdirectories, add the -S flag.

Tags:

Linux

Shell

Bash