Как установить 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.

installbrew · apt · dnf
ignore.gitignore · .fdignore
comparefd vs find
install fdignore rulescommon flags

Что решает 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. Run fd --version after install.

Установка macOS и Linux

  1. 1
    macOS (Homebrew)

    brew install fd. Verify with which fd and fd --version.

  2. 2
    Debian / Ubuntu

    sudo apt update && sudo apt install fd-find. The binary is often fdfind; add alias fd=fdfind or use your distro’s compatibility package for the fd name.

  3. 3
    Fedora / Arch

    Fedora: sudo dnf install fd. Arch: sudo pacman -S fd. Grab release binaries from GitHub if repos lag.

  4. 4
    Optional: Rust

    cargo install fd-find when 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 --help and 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$' ./crates

Add -L to follow symlinks. Full list: fd --help.

fd vs find

Goalfdfind
Name fragmentfd configfind . -iname '*config*'
Extensionfd -e gofind . -name '*.go'
.gitignoreon by defaultmanual -prune or git ls-files
mtime / permissionsuse findfind . -mtime -7, -perm
Exec per hitfd … -x rm {} (dry-run first)find … -exec rm {} +
Max depth--max-depth N-maxdepth N
Portabilitymodern Unix/macOS; see Windows docsPOSIX 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 как создать пространство.

Начать