fd

Updated

September 4, 2026

Overview

fd is a fast, user-friendly alternative to find. Defaults are developer-friendly: colorized output, sensible ignore of hidden files and .gitignore entries, parallel traversal, and simple regex patterns. Keep find for full POSIX power and exotic predicates; use fd for everyday “find me files named …” work.

sudo apt install fd-find   # Debian/Ubuntu binary often named fdfind
# symlink tip on Debian:
# mkdir -p ~/.local/bin && ln -s $(command -v fdfind) ~/.local/bin/fd
sudo dnf install fd-find

Syntax

fd [options] [pattern] [path...]

Common Options

Option Description
-e EXT Extension filter (repeatable)
-t f/d/l/x/e Type: file, dir, symlink, executable, empty
-H Include hidden
-I Don’t respect ignore files
-u / -uu Unrestricted (like rg’s -u)
-x cmd Exec per result ({} placeholder)
-X cmd Batch exec with all results
-d N Max depth
-g glob Glob mode instead of regex
-s Case sensitive (default may be smart case)
-p Match full path
-a Absolute paths
-0 NUL-delimited
-S size Size filter (+1m, -100k)
--changed-within Time filters (version-dependent)

Key Use Cases

  1. Find files by name/extension quickly
  2. Run a command on each match (-x)
  3. Search including gitignored build dirs (-I / -u)
  4. Generate file lists for pipelines (-0 + xargs -0)

Examples with Explanations

By extension and pattern

fd -e md
fd -e go -e rs
fd 'config.*\.ya?ml$'
fd -g '*.toml'

Types and hidden

fd -t d node_modules
fd -t f -e log /var/log
fd -H '^\.env'

Exec

fd -e log -x rm
fd -e jpg -x convert {} {.}_thumb.jpg   # if ImageMagick present
fd -e md -X wc -l

-x runs once per file; -X batches arguments.

Ignore rules

fd pattern           # respects .gitignore
fd -I pattern        # include ignored
fd -u secret         # more unrestricted

One-liner recipes

# Recent-ish markdown under repo (if --changed-within available)
fd -e md --changed-within 7d

# Safe delete of __pycache__
fd -t d -g __pycache__ -x rm -rf

# Feed ripgrep
fd -e py -0 | xargs -0 rg 'TODO'

Notes & Pitfalls

  • On Debian/Ubuntu the binary is often fdfind to avoid clashing with fdclone.
  • Regex is not shell glob by default—use -g for globs.
  • -x rm without care deletes widely; preview with plain fd first.
  • Color can break scripts—use fd --color never or redirect.

2026-relevant notes

  • fd + rg is the modern find/grep pair for source trees; find + grep remain the portable baseline.
  • Large monorepos: prefer fd’s parallelism; for network filesystems test both tools.
  • Combine with fzf for interactive picking: fd -t f | fzf.

Comparison to alternatives

Tool Notes
fd Fast UX defaults
find Full predicates, portable
locate/plocate DB-backed name search
rg --files List files rg would search

Additional Resources

  • Upstream fd README
  • man fd / man fdfind