Skip to content

Instantly share code, notes, and snippets.

@thebouv
Last active June 12, 2025 23:44
Show Gist options
  • Save thebouv/8657674 to your computer and use it in GitHub Desktop.
Save thebouv/8657674 to your computer and use it in GitHub Desktop.
ducks: linux command for the 10 largest files in current directory
du -cks * | sort -rn | head -11
# Usually set this up in my bash profile as an alias:
# alias ducks='du -cks * | sort -rn | head -11'
# Because it is fun to type ducks on the command line. :)
@jacrys
Copy link

jacrys commented Jun 12, 2025

alias 🦆='ls -1A | xargs -d "\n" -I{} du -sb "{}" 2>/dev/null | sort -rn | head -n11 > /tmp/sizes.txt && awk "{sum+=\$1} END {print sum}" /tmp/sizes.txt | numfmt --to=iec --suffix=B > /tmp/total.txt && awk "{print \$1, \$2}" /tmp/sizes.txt | while read -r size name; do size_fmt=$(numfmt --to=iec --suffix=B <<< "$size"); echo -e "$size_fmt\t$name"; done && echo "Total: $(cat /tmp/total.txt)" && rm /tmp/sizes.txt /tmp/total.txt'

@zchrissirhcz
Copy link

zchrissirhcz commented Jun 12, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment