Installer fd : find rapide, règles gitignore, flags courants, vs find

Installer fd, comprendre les ignores, parcourir les flags, garder find pour mtime.

find trouve tout, mais la recherche quotidienne par nom implique des options longues et node_modules. fd (Rust, sharkdp) récursive avec ignores par défaut. Ce guide couvre, 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. installation macOS/Linux, fichiers ignore, flags courants, fd vs find pour les lecteurs de hereink avec 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

Ce que fd règle

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.

Installation macOS et 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.

Règles d’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

Flags courants

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.

Convient
Daily filename/extension lists in repos, scoping scripts, living beside rg and bat.
Ne convient pas
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.

Modules ciblés — aligner sur un tableau

Once paths point at services or crates, boundaries still belong on a shared canvas. See créer un espace.

Ouvrir