From the shell, I need to list the size of all child directories. I am currently using:
du -hs * | sort -hr
However, this only gets one level down and does not traverse the directory tree.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With