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

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.

Facebook Comments

More Stuff

CentOS Dojo at DevConf.us, August 16th in Boston CentOS Dojo at DevConf.us, August 16th in Boston Thursday , 17, May 2018 Rich Bowen announcementThis year, DevConf.us will be held at Boston Unive...
Happy birthday, KDE: 11 applications you never knew existed The Linux desktop environment KDE celebrates its 22nd anniversary on October 14 this year. There are a gazillion* applications created by the KDE comm...
Top 3 benefits of company open source programs Many organizations, from Red Hat to internet-scale giants like Google and Facebook, have established open source programs (OSPO). The TODO Group, a ne...
Blockchain evolution: A quick guide and why open source is at the ... It isn't uncommon, when working on a new version of an open source project, to suffix it with "-ng", for "next generation." Fortunately, in their rapi...
Spread the love

Posted by News Monkey