fd vs find: Faster File Search on Linux

find is installed on almost every Linux system and can express remarkably complex queries. For everyday work, however, its syntax often makes you think about flag order instead of the task. A case-insensitive name search looks like find . -iname '*config*'; in fd, the same intent is simply fd config.
I use fd when I need to locate project files quickly, filter them by type, and pass the result to another tool. Calling it a complete find replacement would be misleading: the programs optimize for different goals. This guide covers installation, practical commands, fzf integration, and cases where classic find remains the better choice.
How fd differs from find
fd chooses developer-friendly defaults:
- parallel directory traversal;
- regular expressions as the default pattern language;
- smart case: lowercase patterns ignore case, while an uppercase character enables case-sensitive matching;
- colorized file types;
- hidden paths and
.gitignoreentries skipped by default; - external commands executed per result or once for the entire result set.
The .gitignore behavior is both a performance advantage and the biggest trap. If a target is hidden or ignored by Git, plain fd pattern will not display it. That is intentional behavior, not missing data or a bug.
Installation: the Ubuntu command may be fdfind
On Arch Linux installation is direct:
sudo pacman -S fd
Debian and Ubuntu package it as fd-find, and the executable is named fdfind because another package already owns fd:
sudo apt install fd-find
fdfind config
To use the upstream documentation unchanged, add a user-local symlink:
mkdir -p ~/.local/bin
ln -s "$(command -v fdfind)" ~/.local/bin/fd
Ensure ~/.local/bin is in PATH. Do not create this link in /usr/bin; local customization should not conflict with the system package manager.
Basic search without a wall of flags
fd accepts a pattern followed by an optional search directory:
# Names containing config below the current directory
fd config
# Search inside /etc
fd config /etc
# Markdown files only
fd --extension md
# Directories containing cache in their name
fd --type directory cache
# Use a glob instead of a regular expression
fd --glob '*.test.py'
By default, the pattern matches a filename, not its full path. Use --full-path for directory structure:
fd --full-path '.*/migrations/.*\.py$'
The distinction matters. fd migrations locates a file or directory with that name, but does not necessarily return every file merely located under migrations.
Hidden files, .gitignore, and unrestricted search
Use --hidden for hidden paths and --no-ignore to disable ignore rules. The short --unrestricted (-u) enables both:
# Include hidden files but skip .git
fd --hidden --exclude .git config
# Search everything
fd --unrestricted config
Do not make -u your permanent default without a reason. In a large repository it traverses node_modules, .git, virtual environments, and build artifacts, removing one of fd's primary advantages.
A separate explicit alias is safer:
alias fda='fd --hidden --no-ignore --exclude .git'
Its name reminds you that this is the expanded search.
Filtering by size and modification time
fd can reduce a result set before handing it to another program:
# Files larger than 100 MiB
fd --type file --size +100m
# Modified in the last day
fd --type file --changed-within 1d
# Not modified for more than 30 days
fd --type file --changed-before 30d
# PNG and JPEG except the export directory
fd --type file --extension png --extension jpg --exclude export
Before any bulk deletion, run exactly the same query without a deletion command. Verify the search root and inspect several results. Friendly syntax does not reduce the cost of a mistake.
Command execution: -x versus -X
-x starts an external command for each result, potentially in parallel. -X starts it once with the whole result set as arguments.
# Extract each ZIP separately
fd --extension zip -x unzip
# Format C and C++ source files
fd --extension h --extension cpp -x clang-format -i
# Open all matching Python tests in one Vim process
fd --glob 'test_*.py' -X vim
Placeholders control arguments: {} is the full path, {/} the basename, {.} the path without extension, and {/.} the basename without extension. Quote them so the shell cannot interpret braces before fd sees them.
fd --extension jpg -x convert '{}' '{.}.png'
There is a useful security property here: -x does not automatically pass a command string through a shell. That reduces surprising expansion, but shell aliases and functions are not executable programs either. When a task requires a pipeline or complex logic, put it in a small script and call that script explicitly.
Combining fd with fzf
fd produces a fast, sensible candidate list, while fzf lets you choose interactively. The upstream documentation suggests:
export FZF_DEFAULT_COMMAND='fd --type file'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
To include hidden files without traversing .git:
export FZF_DEFAULT_COMMAND='fd --type file --hidden --exclude .git'
In a supported shell, the Ctrl-T list is now generated by fd. The same output can feed Rofi, an editor, or a PDF viewer. The power is not one magical command but the Unix model: one tool discovers, another selects, and a third opens or transforms.
Is fd really twenty times faster?
The project README contains a reproducible benchmark: roughly four million files, 750,000 directories, a warm disk cache, and a JPEG filename pattern. In that specific test, fd was about 23 times faster than find -iregex and 13 times faster than find -iname.
That is not a universal guarantee. Process startup dominates a tiny directory, I/O may dominate a cold network filesystem, and different ignore rules may cause the tools to traverse different data. A valid comparison must return the same results under the same conditions. Test your workload with hyperfine:
hyperfine \
"find . -iname '*config*'" \
"fd --unrestricted --glob '*config*'"
Here --unrestricted is not a daily recommendation. It prevents fd from receiving an unfair advantage by skipping hidden and ignored paths.
When find is still the right tool
I do not remove find or rewrite stable system scripts around fd. Prefer find when:
- a script must run on a minimal or unfamiliar Unix system;
- you need complex combinations of ownership, permissions, predicates, and actions;
- installing another binary is impossible;
- existing behavior is tested and there is no reason to change it;
- the task needs a broadly available POSIX-oriented baseline.
I choose fd for interactive use and developer tooling, and find for portability or its richer expression model. These are different abstraction levels, not competing belief systems.
If you are assembling a practical Linux toolkit, continue with the guide to monitoring processes, hardware, and Wi-Fi. Faster search is useful, but without resource visibility it is easy to optimize the wrong part of a system.
Quick reference
fd pattern # filename search
fd -e py # extension
fd -t d cache # directories only
fd -p 'src/.+test' # full path
fd -H pattern # include hidden
fd -I pattern # ignore ignore-files
fd -u pattern # hidden + ignored
fd -E node_modules pattern # exclude a path
fd -e zip -x unzip # command per result
fd -g 'test_*.py' -X vim # one command with all results
Start with fd -h, and use fd --help for the complete reference. Always inspect the result set separately before running a command that modifies files.