CLI Tools bash Intermediate

Find Large Files and Sort

Locate the largest files in a directory tree and display them in human-readable format.

bash
#!/bin/bash
DIR=${1:-.}
LIMIT=${2:-20}
find "$DIR" -type f -exec du -h {} + 2>/dev/null \
  | sort -rh \
  | head -$LIMIT

Prerequisites

  • find
  • du
  • sort

Pro Tips

  • → Add -maxdepth 2 to limit traversal depth.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Intermediate
Read time
1 min
Published
Mar 2026
License
Commercial License

Newsletter

New modules every week, directly to your inbox.