Skip to content
Latchkey

fd: A Simpler, Faster find for CI

fd searches the current directory tree for entries whose name matches a regex (a substring pattern by default), skipping .gitignore-d and hidden files.

fd replaces the awkward find . -name syntax with a single positional pattern. The catch on Debian/Ubuntu is that the binary is named fdfind, not fd.

What it does

fd takes a pattern and lists matching paths under the current directory (or a given root). The pattern is a regex matched against the file name, smart-case by default. Like ripgrep it ignores .gitignore entries and hidden files unless told otherwise.

Common usage

Terminal
fd README                      # names containing "README"
fd '\.test\.ts$'              # regex: files ending in .test.ts
fd --type f --type x           # only executable regular files
fd config src/                 # pattern then search path
fd -H -I node_modules          # include hidden and ignored

Options

FlagWhat it does
--type / -t f|d|l|xRestrict to file, directory, symlink, or executable
--hidden / -HInclude hidden files and directories
--no-ignore / -IDo not respect .gitignore / .ignore
--glob / -gTreat the pattern as a glob instead of a regex
--full-path / -pMatch the pattern against the whole path
--max-depth / -d <n>Limit recursion depth
-0NUL-separate results for xargs -0

In CI

On Debian and Ubuntu the package fd-find installs the binary as fdfind to avoid a name clash, so scripts that call fd break. Either invoke fdfind or add ln -s $(which fdfind) ~/.local/bin/fd. Always pass --no-ignore if you need to find files inside an ignored build directory.

Common errors in CI

"fd: command not found" on Ubuntu often means it IS installed but as fdfind; check with which fdfind. Install via apt-get install -y fd-find, brew install fd, or cargo install fd-find. A pattern that finds nothing usually hit the default ignore rules: add -H -I. "error: the regex is invalid" means the pattern needs --glob or proper escaping.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →