FD
fd
fd is a modern, fast, and user-friendly alternative to find in Linux.
It is used to search for files and directories in your filesystem.
Why Developers Use fd
- Faster than
find– uses smart defaults and parallelism - Simpler syntax – easier for beginners to remember
- Colorized output – makes results readable
- Flexible filtering – supports regex, file types, and exclusions
Basic Usage
- Searches for files/folders matching
<pattern>in the current directory and subdirectories. - Example: Find all
.txtfiles:
Common Options
| Option | Description | Example |
|---|---|---|
-t f |
Search files only | fd -t f README |
-t d |
Search directories only | fd -t d src |
-e <ext> |
Match specific extension | fd -e md (all Markdown files) |
-x <cmd> |
Execute command on each result | fd -e log -x rm {} (delete all .log files) |
-i |
Ignore case | fd -i readme |
Examples
- Search for a file named
config.yamlanywhere:
- Find all
.pyfiles in a project:
- Search directories named
tests:
- Delete all
.tmpfiles safely:
Advanced Usage
- Combine with
grepto search inside files:
- Exclude directories (like
.gitornode_modules):
- Integrate with scripts for automation or CI/CD pipelines.