| created | "2025-12-16T00:00:00.000Z" |
| modified | "2025-12-16T00:00:00.000Z" |
| reviewed | "2025-12-16T00:00:00.000Z" |
| name | fd File Finding |
| description | Fast file finding using fd command-line tool with smart defaults, gitignore awareness, and parallel execution. Use when searching for files by name, extension, or pattern across directories. |
| allowed-tools | Bash, Read, Grep, Glob |
fd File Finding
Expert knowledge for using fd as a fast, user-friendly alternative to find with smart defaults and powerful filtering.
Core Expertise
fd Advantages
- Fast parallel execution (written in Rust)
- Colorized output by default
- Respects
.gitignore automatically
- Smart case-insensitive search
- Simpler syntax than
find
- Regular expression support
Basic Usage
Simple File Search
fd config
fd -e rs
fd -e md
fd -e js -e ts
fd -s Config
Pattern Matching
fd '^test_.*\.py$'
fd '\.config$'
fd '^[A-Z]'
fd '*.lua'
fd 'test-*.js'
Advanced Filtering
Type Filtering
fd -t f pattern
fd -t d pattern
fd -t l pattern
fd -t x pattern
fd -t f -t l pattern
Depth Control
fd -d 1 pattern
fd -d 3 pattern
fd --max-depth 2 pattern
fd --min-depth 2 pattern
Hidden and Ignored Files
fd -H pattern
fd -I pattern
fd -u pattern
fd -H -I pattern
Size Filtering
fd --size +10m
fd --size -1k
fd --size +100k --size -10m
Modification Time
fd --changed-within 1d
fd --changed-within 2w
fd --changed-within 3m
fd --changed-before 1y
Execution and Processing
Execute Commands
fd -e jpg -x convert {} {.}.png
fd -e rs -x rustfmt
fd -e md -X wc -l
Integration with Other Tools
fd -e log | xargs rm
fd -e rs | xargs cat | wc -l
fd -e py | xargs rg "import numpy"
fd -e md | xargs nvim
Common Patterns
Development Workflows
fd -e test.js -e spec.js
fd '^test_.*\.py$'
fd '_test\.go$'
fd -g '*.config.js'
fd -g '.env*'
fd -g '*rc' -H
fd -e rs -e toml -t f
fd -e py --exclude __pycache__
fd -e ts -e tsx src/
Cleanup Operations
fd -e pyc -x rm
fd node_modules -t d -x rm -rf
fd -g '*.log' --changed-before 30d -X rm
fd --size +100m -t f
fd --size +1g -t f -x du -h
Path-Based Search
fd pattern src/
fd pattern src/ tests/
fd -e rs -E target/
fd -e js -E node_modules -E dist
fd -p src/components/.*\.tsx$
Best Practices
When to Use fd
- Finding files by name or pattern
- Searching with gitignore awareness
- Fast directory traversal
- Type-specific searches
- Time-based file queries
When to Use find Instead
- Complex boolean logic
- POSIX compatibility required
- Advanced permission checks
- Non-standard file attributes
Performance Tips
- Use
-j 1 for sequential search if order matters
- Combine with
--max-depth to limit scope
- Use
-t f to skip directory processing
- Leverage gitignore for faster searches in repos
Integration with rg
fd -e py | xargs rg "class.*Test"
fd -e rs | xargs rg "TODO"
fd -e md | xargs rg "# "
Quick Reference
Essential Options
| Option | Purpose | Example |
|---|
-e EXT | Filter by extension | fd -e rs |
-t TYPE | Filter by type (f/d/l/x) | fd -t d |
-d DEPTH | Max search depth | fd -d 3 |
-H | Include hidden files | fd -H .env |
-I | Include ignored files | fd -I build |
-u | Unrestricted (no ignore) | fd -u pattern |
-E PATH | Exclude path | fd -E node_modules |
-x CMD | Execute command | fd -e log -x rm |
-X CMD | Batch execute | fd -e md -X cat |
-s | Case-sensitive | fd -s Config |
-g GLOB | Glob pattern | fd -g '*.json' |
Time Units
s = seconds
m = minutes
h = hours
d = days
w = weeks
y = years
Size Units
b = bytes
k = kilobytes
m = megabytes
g = gigabytes
t = terabytes
Common Command Patterns
fd -e rs --changed-within 1d
fd -d 1 -t f --size +10m
fd -t x -e sh
fd -H -g '*config*'
fd -e py -X wc -l
fd -e js -E dist -E node_modules -E build
This makes fd the preferred tool for fast, intuitive file finding in development workflows.