Size Filtering
The -size predicate is primarily used for identifying large files consuming disk space, or finding suspiciously empty files (0 bytes).
Syntax and Prefixes
Like time filters, -size uses + and - prefixes to indicate "greater than" or "less than".
find /path -size [+/-]N[suffix]
Supported Suffixes
GNU find supports several human-readable suffixes:
| Suffix | Meaning | Example |
|---|---|---|
c | Bytes (characters) | -size +500c (> 500 bytes) |
k | Kilobytes (KiB) | -size +10k (> 10 KiB) |
M | Megabytes (MiB) | -size +50M (> 50 MiB) |
G | Gigabytes (GiB) | -size +1G (> 1 GiB) |
b (or none) | 512-byte blocks | -size +100 (> 50,000 bytes) |
If you omit the suffix entirely, find defaults to 512-byte blocks (e.g., -size +10 means greater than 5 kilobytes). Always use a suffix like M or G to avoid confusion.
Practical Examples
1. Hunting Large Files
When a disk is full, you can use find to rapidly locate the offenders without having to run du across the entire filesystem.
# Find all files larger than 1 Gigabyte
find / -type f -size +1G
2. Finding Empty Files
Empty files can be artifacts of failed scripts or truncated logs. The -empty predicate is a shorthand for -size 0c.
# These two commands are functionally identical
find /var/log -type f -size 0c
find /var/log -type f -empty
3. Bounded Size Searches
You can combine -size predicates using the implicit AND operator to find files within a specific size range.
# Find files between 10MB and 50MB
find /var/opt -type f -size +10M -size -50M