How to Install and Use fd in Linux as a Fast Alternative to Find

The traditional GNU find command has served as the backbone of Unix file search operations for decades, yet its syntax is notoriously verbose and its execution single-threaded. For modern system administrators and developers, fd (also distributed as fdfind) offers an intuitive, blisteringly fast alternative written in Rust. Operating with sensible defaults—such as parallel directory traversal, automated colourised output, case-insensitivity by default, and automatic exclusion of hidden files and .gitignore patterns—fd substantially accelerates terminal workflows.

Installing fd Across Linux Distributions

Due to a naming conflict on Debian-based systems with another utility, the binary is frequently packaged under the name fdfind. Install it using your distribution’s native package manager:

  • Ubuntu and Debian:
    sudo apt update && sudo apt install fd-find

    To use the standard fd command name rather than fdfind, create an alias or symlink in your local bin directory:

    ln -s $(which fdfind) ~/.local/bin/fd
  • Fedora, RHEL, and CentOS:
    sudo dnf install fd-find
  • Arch Linux and Manjaro:
    sudo pacman -S fd
  • Alpine Linux:
    sudo apk add fd

Basic Search Syntax and Smart Case Matching

Unlike find, which requires explicit flags like -name and quotes around wildcards, fd accepts search patterns directly as simple regex or string inputs:

  • Simple Search: To locate any file or folder containing “config” anywhere in the current directory tree:
    fd config
  • Smart Case Sensitivity: If your query contains only lowercase letters (fd report), fd performs a case-insensitive search. If you include an uppercase letter (fd Report), it automatically switches to case-sensitive matching.
  • Explicit Case Control: Override smart matching using -s (case-sensitive) or -i (case-insensitive):
    fd -s Report

Filtering by File Type and Extension

Restricting search queries to specific data types is concise and readable using standard command flags:

  • Filter by Extension: Use the -e flag to search for specific file suffixes without writing glob expressions:
    fd -e py

    To combine a search pattern with an extension filter:

    fd user_auth -e ts
  • Filter by File Type: Use the -t flag followed by f (file), d (directory), l (symlink), x (executable), or e (empty):
    fd -t d backup       # Search only for directories named backup
    fd -t x deploy       # Search only for executable scripts named deploy
    fd -t e              # Locate all empty files and folders

Searching Hidden Files and Git Repositories

By default, fd automatically respects your .gitignore rules and skips hidden files (dotfiles) to preserve speed and avoid clutter. When auditing system configurations, you can easily disable these restrictions:

  • Include Hidden Files: Add the -H (or --hidden) flag:
    fd -H zshrc
  • Ignore .gitignore Restrictions: Add the -I (or --no-ignore) flag to search vendor directories or build artefacts:
    fd -I bundle.js
  • Unrestricted Search: Combine both flags using -u (or -uu to search ignored, hidden, and binary paths):
    fd -u secret_key /etc

Executing Commands on Search Results

One of fd‘s most powerful capabilities is seamless command execution without the awkward syntax of find -exec ... \;:

  • Parallel Command Execution: Use the -x (or --exec) flag to run a command against each matching result concurrently:
    fd -e log -x gzip {}

    Here, {} represents the placeholder for each matched file path, which fd compresses using multi-threaded execution.

  • Batch Command Execution: Use -X (capital X) to pass all discovered paths simultaneously to a single command invocation, ideal for tools like chmod, chown, or text editors:
    fd -e md -X wc -l

Adopting fd streamlines daily terminal operations, combining the performance benefits of Rust-powered multithreading with an interface that prioritises clarity and developer productivity.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.