#!/usr/bin/env bash # Lists the top 10 largest folders within a specific directory. # To list all folder sizes simply remove the pipe to head. du -h --max-depth=1 /path/to/your/directory | sort -rh | head -n 10 # Shows you one level of directories and their sizes du --max-depth=1 /path | sort -r -k1,1n # top 10 largest directories du -a /var | sort -n -r | head -n 10 # top 10 largest directories skipping different file-systems du -a -x /var | sort -n -r | head -n 10 # more compatible looping version for i in G M K do du -ah | grep "[0-9]$i" | sort -nr -k 1 done | head -n 11