Intro
fd searches files according to name, size, type, etc. Don’t get confused with grep which searches the contents of the file.
Alias
The executable is named fdfind in some old versions, and it’s recommended to set fd as an alias.
alias fd='fdfind'
Usage
Regex is used by default
chsu@claudehsu:~/Sandbox$ fd '.*\.rs$'
RustLab/RustHello/hello.rs
RustLab/rust_hi/src/main.rs
Notice
-ioption can be used for case insensitive search.- Files in
.gitignoreare by default ignored, meaningfdrespects.gitignore. Use-Ito include those ignored files. - Hidden files are ignored. Use
-Hto include those hidden files.
Search by File Full Path
With -p option, the regex matches against the file full path, instead of the file name.
chsu@claudehsu:~/Sandbox$ fd -p -i '.*pythonlab.*\.py$'
PythonLab/Scripts/lab.py
Search by File Size
Search by file size using:
+<size>: greater than<size>, such as+1mmeans greater than 1 MB-<size>: smaller than<size>
The command below searches .py files whose size is greater than 800KB.
chsu@claudehsu:~/Sandbox$ fd -l -S +800k '.*\.py$'
-rw-rw-r-- 2 chsu chsu 841K Nov 6 2025 ./AILab/Env/lib/python3.14/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema.py
-rw-rw-r-- 2 chsu chsu 841K Jul 7 00:15 ./DuckDBLab/env/lib/python3.14/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema.py
Search by File Type
-t option can be used to specify the file type
-t, --type <filetype>
Filter the search by type:
'f' or 'file': regular files
'd' or 'dir' or 'directory': directories
'l' or 'symlink': symbolic links
's' or 'socket': socket
'p' or 'pipe': named pipe (FIFO)
'b' or 'block-device': block device
'c' or 'char-device': character device
'x' or 'executable': executables
'e' or 'empty': empty files or directories
The command below searches the current directory to find all directories containing the letter ’t'.
chsu@claudehsu:~/Sandbox$ fd -d 1 -t d '.*t.*'
DataLab
PythonLab
RustLab
Explanation
-dspecifies the max depth, so-d 1means to search the current directory only.-t dspecifies to only search for directory entries.