Boost Your Linux File Searches with fd: Faster, Colorful, and Easy-to-Use
This guide explains how to install the fd command-line tool on various Linux distributions, compares it with the traditional find utility, and demonstrates its faster, color‑coded, case‑sensitive search features, alias setup, type filtering, and how to execute other commands on matched files.
What is fd?
fd is a modern, faster alternative to the Unix find command. It provides a simpler syntax, sensible defaults, colored output, and automatically respects .gitignore files. Benchmarks on the project's GitHub repository show typical speed improvements of 8–9× over find.
Installation
Ubuntu 19.04 and newer: sudo apt-get install fd-find The binary is named fdfind to avoid a name clash. Create a convenient alias: alias fd=fdfind Persist the alias by adding it to ~/.bashrc or ~/.bash_aliases. Equivalent packages for other distributions:
Fedora: sudo dnf install fd-find Manjaro:
sudo pacman -Syu fdBasic Usage
Running fd without options lists files recursively, similar to ls but descending into sub‑directories. fd Search by file extension (case‑insensitive, omit the leading dot): fd -e png Search for a specific file name: fd linuxmi.png Search within a particular directory:
fd passwd /etcType Filtering and Case Sensitivity
Use -t to restrict results to a specific type: f – regular files d – directories l – symbolic links x – executable files e – empty files
Example – find directories named images: fd -td images Searches are case‑insensitive by default. Including an uppercase character forces case‑sensitive matching:
fd -tf linux # matches “linux” and “Linux"
fd -tf Linux # matches only “Linux"Executing Commands on Matches
The -x (or --exec) option runs a command for each matched file. Placeholders can be used to refer to parts of the path: {} – full path {.} – path without extension {/} – basename {//} – parent directory {/.} – basename without extension
Example – unzip every .zip file into its own parent directory:
fd -e zip -x unzip {} -d {//}Summary
fd offers a concise, high‑performance interface for file searching on Linux. It does not aim to replace find in all scenarios, but for everyday use it provides faster results, built‑in .gitignore awareness, colored output, and flexible command execution.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
