...

Linux : How do you display each sub-directory size in a list format via the command line

gorilla-chimp

If you want to get a list of the directories and their sizes in a list format then siply use the below:

du -h
Provides this but it displays all of the sub-folders.
du -h --max-depth=1

Alternative

If --max-depth=1 is a bit too long for your taste, you can also try using:

du -h -s *

This uses -s (--summarize) and will only print the size of the folder itself by default. By passing all elements in the current working directory (*), it produces similar output as --max-depth=1 would:

The difference is subtle. The former approach will display the total size of the current working directory and the total size of all folders that are contained in it… but only up to a depth of 1.

Discover more from WIREDGORILLA

Subscribe now to keep reading and get access to the full archive.

Continue reading