Как установить fd: быстрый find, gitignore, флаги, сравнение с find
Поставить fd, понять ignore, флаги, find для mtime и POSIX.
find находит всё, но ежедневный поиск по имени — длинные флаги и node_modules. fd (Rust, sharkdp) по умолчанию рекурсивен и уважает ignore. Материал:, but daily filename searches in a repo mean long flags and trips through node_modules. fd (Rust, by sharkdp) defaults to recursive search with ignore rules applied. установка macOS/Linux, ignore-файлы, флаги, fd vs find для читателей hereink рядом с ripgrep.
The query is how to install fd fast find with gitignore rules and compare to find. You should finish with fd on PATH, a first search from the repo root, a clear picture of what gets skipped by default, and when to keep find for mtime or POSIX scripts.
Что решает fd
Shorter than find for names
find . -iname '*config*' needs path, tests, and quoting. fd config recurses from the current directory, matches path substrings or patterns (see -g), prints one path per line—ready for rg, bat, or -x.
Same ignore story as ripgrep
rg searches content; fd lists paths. Both respect .gitignore in Git trees so dist and dependency folders stay out of casual listings. Our bat guide covers highlighted reading; this article stays on fd alone.
Upstream:
github.com/sharkdp/fd. Runfd --versionafter install.
Установка macOS и Linux
- 1macOS (Homebrew)
brew install fd. Verify withwhich fdandfd --version. - 2Debian / Ubuntu
sudo apt update && sudo apt install fd-find. The binary is oftenfdfind; addalias fd=fdfindor use your distro’s compatibility package for thefdname. - 3Fedora / Arch
Fedora:
sudo dnf install fd. Arch:sudo pacman -S fd. Grab release binaries from GitHub if repos lag. - 4Optional: Rust
cargo install fd-findwhen you already ship a Rust toolchain.
Правила ignore
Inside a Git repo, fd applies ignore rules by default, similar to ripgrep:
- .gitignore in the tree; ignored paths usually stay hidden even if untracked.
- .ignore and global ignore files (see
fd --helpand the README ignore section). - .fdignore for fd-only excludes without editing the team
.gitignore. - The .git directory is not treated like a normal search target for everyday file finds.
fd Cargo.toml
fd --no-ignore vendor
fd -I secret
fd -H .env
fd --max-depth 1 MakefileЧастые флаги
fd -e rs
fd -t f README
fd -t d src
fd -i dockerfile
fd -g '*.min.js'
fd -E node_modules -E '*.pyc' test
fd -e md -x wc -l {}
fd '\.toml$' ./cratesAdd -L to follow symlinks. Full list: fd --help.
fd vs find
| Goal | fd | find |
|---|---|---|
| Name fragment | fd config | find . -iname '*config*' |
| Extension | fd -e go | find . -name '*.go' |
| .gitignore | on by default | manual -prune or git ls-files |
| mtime / permissions | use find | find . -mtime -7, -perm |
| Exec per hit | fd … -x rm {} (dry-run first) | find … -exec rm {} + |
| Max depth | --max-depth N | -maxdepth N |
| Portability | modern Unix/macOS; see Windows docs | POSIX everywhere |
Pair with ripgrep: fd -e py | xargs rg 'def main'; prefer fd … -x rg pattern {} when paths may contain spaces.
- Подходит
- Daily filename/extension lists in repos, scoping scripts, living beside rg and bat.
- Не подходит
- Disk cleanup by mtime, heavy boolean find expressions, or minimal POSIX-only containers—keep
find.
Ubuntu ships fdfind only?
Package fd-find installs fdfind. Alias fd=fdfind in your shell rc or use a compat package.
Overlap with the fd+bat article?
That guide adds bat and pipe recipes; this one goes deeper on ignore rules and find comparison. Read both if you want the full stack.
Regex or substring?
Default matching behaves like a path substring unless you opt into other modes; use -g for globs. When unsure, run a plain fd fragment first, then check fd --help SEARCH.
Модули найдены — сверить на одном листе
Once paths point at services or crates, boundaries still belong on a shared canvas. See как создать пространство.