Guides 11792 Published by

The fd command is a modern, faster alternative to the old‑school `find` that lets you write simple glob patterns without drowning in backslashes and quotes. Installing it is straightforward: on Ubuntu or Debian run sudo apt install fdfind (the binary ends up as /usr/bin/fd), on Fedora use dnf install fd-find, on Arch just pacman -S fd, and if your distro misses it you can grab a GitHub release binary into /usr/local/bin. Once installed, fd shines with handy flags—‑t to filter files or directories, ‑e for extensions, and ‑E for regexes—while automatically handling hidden files and case insensitivity, so commands like fd -e md 'TODO' run in a fraction of the time it takes to debug a complex `find` call. It’s perfect for discovery and quick lookups; when you need to act on matches, pair fd with xargs or shell scripts, but otherwise integrate it into your prompt, editor searches, or automation pipelines for a cleaner, faster file‑search workflow.



How to Install and Use the fd Command on Linux

The fd command is a modern, faster alternative to find that keeps your shell sessions clean and your commands readable. In this post you’ll get it up and running, learn why it’s handy in real‑world scenarios (like hunting down a missing config file after an update), and see how to squeeze the most out of its features.

Why fd Beats find in Practice

find has been around forever, but it forces you to wrap every flag in backslashes or quotes. When you’re looking for a single file named config.yaml, typing

find . -name config.yaml

is fine, yet if you want to ignore hidden directories and only look for files, the syntax quickly turns into a nightmare:

find . -type f -not -path "/\." -name "*.py"

fd streamlines this. You write exactly what you’re searching for, and it automatically handles case‑insensitivity, hidden files, and more. I’ve seen people spend minutes debugging why their find syntax isn’t working; fd just runs.

Installing fd on Your Distribution
Ubuntu / Debian
sudo apt update && sudo apt install fdfind

The package is named fdfind, but the executable is /usr/bin/fd. No alias needed:

alias fd=fdfind   # optional, if you prefer the shorter name everywhere
Fedora / RHEL
sudo dnf install fzf   # oh wait, that’s a different tool!
sudo dnf install fd-find
alias fd=fd-find
Arch Linux / Manjaro
sudo pacman -S fd

If your distro doesn’t ship it, you can download the binary from the GitHub releases page and drop it into /usr/local/bin.

Quick One‑Liner Examples

Search for any file named Makefile in the current directory tree:

fd Makefile

Find all .sh files under /opt/apps, ignoring hidden folders:

fd -a --no-ignore .sh /opt/apps

If you’re trying to locate a plugin that was just installed but can’t remember where it lives, this is the command you want. It returns results in seconds even on 50‑kB directories.

Customizing Search with Flags
Flag What It Does Why You’d Use It
-t f or -t d Filter by file type (file/dir) Keep the output tight.
-e txt Only show files with that extension Avoid a flood of unrelated matches.
-E '.*\.log$' Regex pattern, case‑insensitive by default When you need more precise control than simple globbing.
--color=always Highlight matches Easier on the eyes when scanning long lists.

Example: find all Markdown files that contain “TODO” in their names:

fd -e md 'TODO'
Integrating fd Into Your Workflow

1. Shell Prompt – Add a quick function to your .bashrc or .zshrc:

   f() { fd "$@" | head -n 20; }

Now f project lists the first 20 matches, perfect for a quick glance.

2. Editor Search – Many editors (Vim, VS Code) support external search tools. Point them to fd --color=never so you get clean output without ANSI codes.

3. Automation Scripts – When writing shell scripts that need to locate files, replace loops over find with a single fd call. It eliminates the need for complex while read constructs and speeds execution dramatically.

When fd Isn’t Enough

If you need to perform actions on each match (like moving or deleting) without writing an extra script, find -exec still has its place. fd is great for discovery; if you’re building a pipeline that modifies files, you’ll likely end up wrapping it with xargs or another tool.

That’s the low‑down: install it, use simple glob patterns, and let fd do the heavy lifting when you’re hunting for files on Linux.