How to sort directories (folders) by size in Linux

du --si --max-depth=1 /home/ | sort -n -r |more

Breakdown:
du = show disk usage
-si = in human readable (aka "nice") numbers
--max-depth=1 only show this and 1 subdirectory deep

the output is then piped to sort in numeric order reversed (i.e. largest first)

the output is then piped to more so you get it page at a time.

原文地址:https://www.cnblogs.com/songyuejie/p/15321072.html