Size and Time Filtering
fd includes built-in support for filtering by file size and modification time, using a syntax that is much more human-readable than traditional find.
1. Size Filtering (-S, --size)
Use -S followed by a limit and a unit suffix. Supported suffixes include b (bytes), k (kilobytes), m (megabytes), g (gigabytes), and t (terabytes).
Use + for "greater than" and - for "less than".
# Find files larger than 500 Megabytes
fd -S +500m
# Find files smaller than 10 Kilobytes
fd -S -10k
# Find files between 10MB and 50MB
fd -S +10m -S -50m
Note: Unlike find, fd's size calculations are exact and do not rely on arcane block-size assumptions.
2. Time Filtering (--changed-within, --changed-before)
fd allows you to filter by modification time using absolute dates, relative durations, or human-readable English phrases. This is a massive ergonomic improvement over find -mtime.
Relative Durations
You can use suffixes like s (seconds), m (minutes), h (hours), d (days), w (weeks), mo (months), y (years).
# Find files modified in the last 2 weeks
fd --changed-within 2w
# Find files modified more than 6 months ago (older files)
fd --changed-before 6mo
Human Readable Phrases
fd includes a built-in date parser that understands common English phrases.
# Find files modified today
fd --changed-within "today"
# Find files modified since yesterday
fd --changed-within "yesterday"
Absolute Timestamps
You can provide exact dates or datetime strings.
# Find files modified after a specific date
fd --changed-within "2023-10-31"
# Find files modified before a specific date and time
fd --changed-before "2023-10-31 15:30:00"
The Short Flags
Typing --changed-within is tedious. fd provides short aliases:
--change-newer-than(Alias for--changed-within)--change-older-than(Alias for--changed-before)
(Note: There are no single-letter short flags for time filtering to avoid conflicts with other options).