Fundamentals 6 min read

Why fd Beats find: Fast, Parallel File Searching with Rust

This guide introduces the Rust‑based fd command as a faster, more user‑friendly alternative to find, covering installation on Linux and macOS, basic and advanced usage examples, and key options like pattern matching, extensions, exec, and time‑based filters.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Why fd Beats find: Fast, Parallel File Searching with Rust

Many Linux developers rely on the find command, but its performance and output can be limited for large searches. The fd tool, written in Rust, offers sensible defaults, parallel directory traversal, regex and glob support, and a more ergonomic interface.

Installation

On Linux you can install fd from your distribution’s package manager (e.g., sudo dnf install fd-find on Fedora). On macOS it is available via Homebrew ( brew install fd) or MacPorts. Alternatively, you can install it directly with Cargo:

cargo install fd-find

Basic Usage

Running fd with a pattern searches the current directory recursively. For example: fd sh To limit the search to a specific directory, provide the directory as a second argument:

fd passwd /etc

Filtering by Extension

Use the -e option to restrict results to a particular file extension:

fd . '/home/ssur/exa' -e md

Executing Commands on Matches

The -x (or --exec) option runs an external command for each match, while -X (or --exec-batch) passes all matches to a single command. Example – unzip every ZIP file found:

fd -e zip -x unzip

Time‑Based Filters

Find files changed within the last n days with --changed-within: fd . '/home/ssur/Work/' --changed-within 10d Find files changed before a certain period with --changed-before:

fd . '/home/ssur/Work/' --changed-before 365d

Case Sensitivity

Search patterns are case‑insensitive by default, making it easy to locate files without exact case knowledge. If the pattern contains an uppercase letter, fd automatically switches to case‑sensitive matching.

Conclusion

The fd utility provides a fast, color‑coded, and feature‑rich alternative to find, simplifying common file‑search tasks across Linux and macOS environments.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

macOSFile Searchfd
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.