Skip to main content

fd Cheatsheet

fd is a lightning-fast Rust-based file search tool, a modern replacement for the traditional find command. Uses regex by default, automatically respects .gitignore and hidden files, supports extension, time, and size filtering with parallel command execution. 43K+ GitHub Stars.

Updated: 2026-07-20·30 commands

Quick Start

``bash fd 'config.json' # Search by filename (regex) fd -e py # Find all Python files fd -t d 'src' # Find directories named src fd -H '.env' # Include hidden files fd -e log -x rm # Delete all log files fd --changed-within 1week # Files modified in the last week `

Search files and directories by name using regex patterns. fd is case-insensitive by default and searches recursively from the current directory.

`bash fd 'config.json' # Regex search for matching filenames fd -s 'Config' # Case-sensitive search fd -i 'readme' # Explicit case-insensitive search fd -g '*.log' # Glob pattern instead of regex fd -d 3 'main' # Limit search to 3 levels deep fd --search-path /var/log # Search from a specific root fd --absolute-path 'config' # Output absolute paths fd --full-path 'src/.*test' # Match against full path, not just filename `

Filter Options

Powerful filtering by extension, file type, size, time, and exclusion patterns.

`bash fd -e py # Only Python files fd -t f 'config' # Files only (no directories) fd -t d 'src' # Directories only fd -t l 'link' # Symbolic links only fd -E 'node_modules' -e js # Exclude node_modules fd --size '+100MB' # Files larger than 100MB fd --size '-1KB' # Files smaller than 1KB fd --changed-within '1week' # Modified in the last week fd --changed-before '2024-01-01' # Modified before a date fd --changed-within '30min' # Modified in the last 30 minutes `

Execute Commands

Run commands on search results with flexible placeholder syntax.

`bash fd -e py -x wc -l # Count lines per Python file fd -e jpg -x convert {} {.}.png # Convert JPG to PNG ({} = full path, {.} = no ext) fd -e txt -X cat # Batch: cat all txt files at once fd -e py --exec-batch chmod +x # Explicit batch exec fd -e log --exec rm {} + # Parallel execution (like find -exec +) fd -e mp3 -x mv {} /backup/ # Move files to backup dir fd -0 -e py | xargs -0 wc -l # NUL-separated output for xargs `

Advanced Options

Fine-tune fd's behavior with hidden files, symlinks, ignore rules, and parallelism.

`bash fd -H '.env' # Include hidden and .gitignore'd files fd -L 'data' # Follow symbolic links fd --no-ignore 'secret' # Ignore .gitignore rules fd --no-ignore-vcs 'config' # Ignore VCS ignore rules only fd --no-ignore-parent 'output' # Don't read parent .gitignore fd --color always 'pattern' # Force colored output fd -j 8 -e py # Use 8 parallel threads fd -0 -e py | xargs -0 wc -l # NUL-delimited output for xargs -0 `

Expert Tips

`bash # Find large files (>100MB) modified in the last week fd -H --size '+100MB' --changed-within '1week' -t f

# Bulk rename: replace spaces with underscores in all file names fd -g '* *' -x bash -c 'mv "$1" "${1// /_}"' _ {}

# Recursively count all lines in Python files fd -e py -X wc -l

# Copy all matching files to a target directory fd -e pdf -x cp {} /target/

# Interactive deletion with preview (using fzf) fd -e log -0 | fzf --read0 --multi | xargs -0 rm

# Find symlinks broken across the filesystem fd -t l -L -s -H . | while read -r link; do [ ! -e "$link" ] && echo "$link"; done ``

Basic Search(10)

CommandLevel
fd --help
Show fd help
Basic
fd PATTERN
Recursively search files whose names match PATTERN
Basic
fd -s
Case-sensitive search (default is case-insensitive)
Basic
fd -i
Case-insensitive search (explicit)
Basic
fd -g PATTERN
Use glob pattern matching (not regex)
Intermediate
fd -H
Search hidden files and files ignored by .gitignore
Intermediate
fd -d N
Limit maximum search depth
Basic
fd --full-path
Match against full path (not just filename)
Intermediate
fd --absolute-path
Output absolute paths
Basic
fd --search-path DIR
Specify search root directory
Basic

Filter Options(8)

CommandLevel
fd -e EXT
Filter by file extension
Basic
fd -t f
Search files only (no directories)
Basic
fd -t d
Search directories only
Basic
fd -t l
Search symbolic links
Intermediate
fd -E PATTERN
Exclude files matching a pattern
Basic
fd --changed-within DURATION
Find files changed within a duration
Intermediate
fd --changed-before DURATION
Find files changed before a given time
Intermediate
fd --size SIZE
Filter by file size
Intermediate

Execute(5)

CommandLevel
fd PATTERN -x CMD
Execute a command for each search result
Basic
fd PATTERN -x CMD {}
Use {} placeholder for argument position
Intermediate
fd PATTERN -X CMD
Batch execute (all results as one invocation)
Intermediate
fd PATTERN --exec-batch CMD
Explicit batch execute with command
Intermediate
fd PATTERN --exec CMD {} +
Parallel execution (like find -exec +)
Expert

Advanced(7)

CommandLevel
fd -L
Follow symbolic links
Intermediate
fd --no-ignore
Ignore .gitignore rules
Intermediate
fd --no-ignore-vcs
Ignore VCS ignore rules (keep .gitignore dir filtering)
Expert
fd --no-ignore-parent
Do not read parent directories' .gitignore
Expert
fd -0
Separate output by NUL character (use with xargs -0)
Expert
fd --color always
Force colored output (even when piped)
Intermediate
fd -j N
Set number of parallel threads
Intermediate

FAQ

This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-20.