Jump to content

Command Crate ¿about?

Display top 10 largest directories (find, du, awk)

find . -type d -exec du -h --max-depth=1 {} + 2>/dev/null | sort -rh | head -n "10" | awk -v highlighter="\033[1;32m" -v reset="\033[0m" '{gsub(/[0-9,.]+[MGK]|^0[[:space:]]/, highlighter "&" reset); print}'

Finds and lists the top 10 largest directories, highlighting their sizes, sorted in descending order

file management [kb:205]