fd: a simpler, faster alternative to find
TL;DR
fd finds files with short syntax and skips hidden and .gitignored files by default. -e filters extensions, -t types, -H -I includes everything, -x runs per file in parallel, -X batches into one command.
find is powerful but its syntax is hard to remember: find . -type f -name "*.py" -not -path "*/node_modules/*" just to list Python files. fd is a simpler, faster alternative: short syntax, hidden and .gitignored files skipped by default, coloured output, and parallel command execution on each result. It doesn't do everything find does, but it covers 90% of everyday cases neatly.

Installation
brew install fd # macOS
sudo apt install fd-find # Ubuntu/Debian: the command is fdfind
cargo install fd-find # with Rust
# On Ubuntu
ln -s $(which fdfind) ~/.local/bin/fd
Quick comparison with find
| Task | find | fd |
|---|---|---|
| Files with "config" in the name | find . -iname '*config*' | fd config |
| All .py files | find . -name '*.py' | fd -e py |
| Directories only | find . -type d -name 'test*' | fd -t d '^test' |
| Include hidden and ignored files | (default) | fd -H -I pattern |
| Modified in the last 2 days | find . -mtime -2 | fd --changed-within 2d |
fd patterns are regular expressions by default and use smart case: lowercase is case-insensitive, any capital makes it case-sensitive. For shell-style globs add -g: fd -g '*.test.ts'.
Running commands on results
# -x: run in parallel for each file
fd -e jpg -x convert {} {.}.png
# -X: pass all results to ONE command
fd -e ts -X prettier --write
# Delete nested node_modules folders (needs -I because they're ignored)
fd -I -t d '^node_modules$' -X rm -rf
| Placeholder | Meaning | Example for src/img/a.jpg |
|---|---|---|
{} | Full path | src/img/a.jpg |
{.} | Without extension | src/img/a |
{/} | File name only | a.jpg |
{//} | Parent directory | src/img |
Caveats
- Can't find a file you know exists? It may be gitignored or hidden; add
-H -I. - Be careful with
rm: run fd without-x/-Xfirst to see what would be deleted. - Exclude specific directories with
-E, e.g.fd -e log -E vendor.
How to apply it
- Dev: Use fd as fzf's source (
FZF_DEFAULT_COMMAND='fd --type f') for an IDE-style "Go to file" in the terminal. - Tech Lead: Write cleanup and bulk-conversion scripts (images, code formatting) with
-x/-Xinstead of shell loops that break on file names with spaces. - PM: For quick counts (how many test files, config files),
fd -e test.ts | wc -lgives an answer immediately.
Sources & references
- sharkdp/fd — sharkdp (GitHub)