Linux: how to get a list of folders sorted by size

To get the list of folders of a specific folder sorted by size, use the command “du” (disk usage)

For example if you want to list the folders of “/home” sorted by size:
du -sh /home/* | sort -h

Example of output:

153K /home/michel
272M /home/julien
18G /home/vianney

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.