We use cookies to understand how the site is used and to display ads. Analytics and advertising only run after you accept. You can change your choice anytime. Privacy policy

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 name· Regex pattern matching.
fd "main"
fd "config.*json"
fd "^test_"
fd "\.tsx$"
fd -e tsx

Filtering

Search by extension· File type filter.
fd -e py
fd -e js -e ts
fd -e md --no-ignore
fd -e txt -d 2
Search by type· Files, 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 gitignore· Control ignored files.
fd -H pattern
fd -I pattern
fd --no-ignore -e node_modules
fd -H -t d ".config"

Execution

Execute command· Run 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 tricks· Custom 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/fzf· Open files.
vim $(fd -t f | fzf)
cd $(fd -t d | fzf)

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