$linuxjunkies
>

fd(1)

A fast alternative to find that searches for files and directories with simpler syntax and colorized output.

UbuntuDebianFedoraArch

Synopsis

fd [OPTIONS] [PATTERN] [PATH]

Description

fd is a user-friendly replacement for the traditional find command. It uses parallel searching, respects .gitignore files by default, and provides intuitive glob patterns without complex flag syntax.

By default, fd searches recursively from the current directory, skips hidden files and directories, and excludes paths listed in .gitignore. It colorizes output and supports regex patterns, making file searching faster and more discoverable than find.

Common options

FlagWhat it does
-i, --case-insensitiveCase-insensitive search
-e, --extension <ext>Filter by file extension (e.g., -e txt)
-t, --type <type>Filter by type: f (file), d (directory), l (symlink), x (executable), s (socket), p (pipe)
-H, --hiddenInclude hidden files and directories
-I, --no-ignoreDo not respect .gitignore files
-x, --exec <cmd>Execute command for each search result; use {} as placeholder
-0, --print0Print null-separated output (useful with xargs -0)
-l, --listList each result once per line (default output format)
-d, --max-depth <depth>Limit search recursion depth
-a, --absolute-pathShow absolute paths instead of relative

Examples

Search for files/directories matching pattern recursively from current directory

fd pattern

Find all .txt files in current directory and subdirectories

fd -e txt

Find all directories named 'config' (case-sensitive)

fd -t d config

Case-insensitive search for files containing 'readme'

fd -i -t f readme

Include hidden files; find files containing '.bash' (shows .bashrc, .bash_history, etc.)

fd -H .bash

Find files named 'src' up to 2 levels deep

fd -d 2 -t f src

Find all .rs files and count lines in each using wc

fd '\.rs$' -x wc -l

Search in a specific directory, non-recursive (depth 1)

fd pattern /path/to/search --max-depth 1

Related commands