Sort folders by size

From Sidvind
Jump to: navigation, search

It seems like many people don't know about some new flags for du and sort.

Code: summarize target size

  1. du --summarize /path/to/target

The --summarize flag shows the total size of target only.

Code: Sort human readable numbers

  1. sort -h

-h will sort like -n but supports suffixes like 14K.

Code: Sort folder content by size

  1. du -h --summarize /path/to/target/* | sort -h