How to list directories ordered by the size in shell

Shells like Bash or Zsh are very powerfull.

Sometimes it’s necessary to get the size of subdirectories and order them by size, ideally in human readable way.

The solution for Bash or Zsh is pretty simple. It requires just additional parameter -h added to sort command.

du -sh * | sort -h

The result is nicely sorted list of directories in human readable way.