/commands/find/find-files-larger-than-size
find files larger than 100MB: find . -type f -size +100M
- tool
- find
- versions
- GNU findutils 4.x, BSD find
- os
- linux, macos, windows
find . -type f -size +100M lists regular files larger than 100 MiB under the current directory. + means greater than, - less than, and no sign means exactly. The suffixes are c (bytes), k (KiB), M (MiB) and G (GiB); without a suffix the unit is a 512-byte block. find rounds each file's size up to whole units before comparing, which matters for the "smaller than" form.
Larger than a size
mkdir -p logs
truncate -s 2M logs/big.log
truncate -s 1536K logs/medium.log
truncate -s 1M logs/exact.log
truncate -s 500K logs/small.log
find . -type f -size +1M | sortOutput
./logs/big.log ./logs/medium.log
exact.log (exactly 1 MiB) is not listed: +1M means more than one unit after rounding.
Smaller than a size: the rounding trap
mkdir -p data
truncate -s 500K data/small.log
truncate -s 100 data/tiny.txt
: > data/empty.txt
echo "-size -1M:"; find data -type f -size -1M | sort
echo "-size -1024k:"; find data -type f -size -1024k | sortOutput
-size -1M: data/empty.txt -size -1024k: data/empty.txt data/small.log data/tiny.txt
With -size -1M, a 500 KiB file rounds up to 1 MiB, and 1 is not less than 1, so only empty files match. Use a smaller unit (-1024k, or -1048576c for bytes) to get the result you expect.
Show sizes, largest first
truncate -s 2M big.bin
truncate -s 1536K mid.bin
truncate -s 300K small.bin
find . -type f -size +256k -printf '%s\t%p\n' | sort -rnOutput
2097152 ./big.bin 1572864 ./mid.bin 307200 ./small.bin
-printf is GNU find only. On macOS, use find . -type f -size +256k -exec ls -lh {} +, or stat -f '%z %N'.
Useful combinations
| Task | Command |
|---|---|
| Larger than 1 GiB, whole disk, stay on one filesystem | find / -xdev -type f -size +1G 2>/dev/null |
| Between 10 and 100 MiB | find . -type f -size +10M -size -100M |
| Exactly 0 bytes (empty files) | find . -type f -empty |
| Large files changed in the last 7 days | find . -type f -size +100M -mtime -7 |
| Human-readable list (GNU) | find . -type f -size +100M -exec du -h {} + | sort -rh |