sort directories by size linux code example
Example 1: ubuntu du sort by dir size
du -Sh /path/to/dir | sort -rh | head -20
Example 2: ls by size
ls -lS # -l to see list with sizes, -S to sort
du -Sh /path/to/dir | sort -rh | head -20
ls -lS # -l to see list with sizes, -S to sort