Find the 50 largest files

Shell utility Reference ↗

Find the 50 largest files in the current directory and all its subdirectories, including hidden files. Sort by size in bytes before converting the results to readable units.

find . -type f -printf '%s\t%p\n' | sort -nr | head -n 50 | numfmt --field=1 --to=iec  

find -type f selects regular files. %s prints the size in bytes and %p the path, separated by a tab. sort -nr puts the largest files first, head -n 50 keeps up to 50 results, and numfmt formats the first column using powers of 1024.

On macOS, use the built-in find and stat commands to list the 50 largest files with their sizes in bytes. No additional tools are required:

find . -type f -exec stat -f '%z %N' {} + | sort -nr | head -n 50  

For human-readable sizes such as 1K, 25M or 3G (powers of 1024), install the additional GNU tools findutils and coreutils with Homebrew, then use this alternative:

brew install findutils coreutils

gfind . -type f -printf '%s\t%p\n' | sort -nr | head -n 50 | gnumfmt --field=1 --to=iec  

These are apparent file sizes, which can differ from allocated disk usage reported by du. Symbolic links are not followed. This line-based command is intended for terminal inspection; filenames containing tabs or newlines can make the output ambiguous.

macOS packages: findutils and coreutils.