Skip to content
>_devvkit
$devvkit learn --librarie fd-guide

fd Guide

[file-search][cli][rust][productivity]
Dev Productivity
Install
brew install fd
sudo apt install fd-find
cargo install fd-find
# Windows: scoop install fd
npm install -g fd-find

fd is 3-5x faster than find, respects .gitignore by default, and uses colorized output. The regex-based pattern matching is more intuitive than find's -name syntax. Common: `fd pattern` (search name), `fd -e py` (find .py files), `fd -t d src` (find directories).

fd integrates with fzf: `vim $(fd -tf | fzf)`. Use -x for per-file execution, -X for batch (all files as args). Add -H to include hidden files, -I to ignore .gitignore, -d to limit depth.

For content search, pair with ripgrep: `fd -e py -x rg "TODO" {}`. Use --exec-batch for bulk operations on all results at once.

Search

Search by nameRegex pattern matching.
fd "main"
fd "config.*json"
fd "^test_"
fd "\.tsx$"
fd -e tsx

Filtering

Search by extensionFile type filter.
fd -e py
fd -e js -e ts
fd -e md --no-ignore
fd -e txt -d 2
Search by typeFiles, dirs, symlinks.
fd -t f pattern
fd -t d pattern
fd -t l pattern
fd -t x pattern
fd -t f -e py "test"
Hidden and gitignoreControl ignored files.
fd -H pattern
fd -I pattern
fd --no-ignore -e node_modules
fd -H -t d ".config"

Execution

Execute commandRun on each result.
fd -e py -x python {}
fd -e txt -x wc -l {}
fd -e md -X npx prettier --write
fd -e jpg -X tar czf images.tar.gz
fd -e log -X rm {}
Placeholder tricksCustom filename handling.
# {} = full path
# {.} = no extension
# {/} = basename
# {//} = parent dir
# {/.} = basename no extension

fd -e py -x echo {.}
fd -e jpg -x mv {} {//}/backup/{/}

Integration

Integration with vim/fzfOpen files.
vim $(fd -t f | fzf)
cd $(fd -t d | fzf)

# Edit all Python files in project:
fd -e py -X nvim