- Recursively find files matching the given pattern in the current directory:
- Find files that begin with
- Find files with a specific extension:
fd --extension txt
- Find files in a specific directory:
fd 'pattern' path/to/directory
- Include ignored and hidden files in the search:
fd --hidden --no-ignore 'pattern'
- Execute a command on each search result returned:
fd 'pattern' --exec command
fd [-HIEsiaLp0hV] [-d depth] [-t filetype] [-e ext] [-E exclude] [-c when] [-j num] [-x cmd] [pattern] [path...]
fd is a simple, fast and user-friendly alternative to find(1).
- -H, --hidden
Include hidden files and directories in the search results (default: hidden files and directories are skipped).
- -I, --no-ignore
Show search results from files and directories that would otherwise be ignored by .gitignore, .ignore, .fdignore, or the global ignore file.
- -u, --unrestricted
Alias for '--no-ignore'. Can be repeated; '-uu' is an alias for '--no-ignore --hidden'.
Show search results from files and directories that would otherwise be ignored by .gitignore files.
- -s, --case-sensitive
Perform a case-sensitive search. By default, fd uses case-insensitive searches, unless the pattern contains an uppercase character (smart case).
- -i, --ignore-case
Perform a case-insensitive search. By default, fd uses case-insensitive searches, unless the pattern contains an uppercase character (smart case).
- -g, --glob
Perform a glob-based search instead of a regular expression search.
Perform a regular-expression based search (default). This can be used to override --glob.
- -F, --fixed-strings
Treat the pattern as a literal string instead of a regular expression. Note that this also performs substring comparison. If you want to match on an exact filename, consider using '--glob'.
- -a, --absolute-path
Shows the full path starting from the root as opposed to relative paths.
- -l, --list-details
Use a detailed listing format like 'ls -l'. This is basically an alias for '--exec-batch ls -l' with some additional 'ls' options. This can be used to see more metadata, to show symlink targets and to achieve a deterministic sort order.
- -L, --follow
By default, fd does not descend into symlinked directories. Using this flag, symbolic links are also traversed.
- -p, --full-path
By default, the search pattern is only matched against the filename (or directory name). Using this flag, the pattern is matched against the full path.
- -0, --print0
Separate search results by the null character (instead of newlines). Useful for piping results to xargs.
- --max-results count
Limit the number of search results to 'count' and quit immediately.
Limit the search to a single result and quit immediately. This is an alias for '--max-results=1'.
Enable the display of filesystem errors for situations such as insufficient permissions or dead symlinks.
- --one-file-system, --mount, --xdev
By default, fd will traverse the file system tree as far as other options dictate. With this flag, fd ensures that it does not descend into a different file system than the one it started in. Comparable to the -mount or -xdev filters of find(1).
- -h, --help
Print help information.
- -V, --version
Print version information.
- -d, --max-depth d
Limit directory traversal to at most d levels of depth. By default, there is no limit on the search depth.
- --min-depth d
Only show search results starting at the given depth. See also: '--max-depth' and '--exact-depth'.
- --exact-depth d
Only show search results at the exact given depth. This is an alias for '--min-depth <depth> --max-depth <depth>'.
Do not traverse into matching directories.
- -t, --type filetype
Filter search by type:
- f, file
- d, directory
- l, symlink
- x, executable
- e, empty
empty files or directories
- s, socket
- p, pipe
named pipes (FIFOs)
This option can be used repeatedly to allow for multiple file types.
- -e, --extension ext
Filter search results by file extension ext. This option can be used repeatedly to allow for multiple possible file extensions.
If you want to search for files without extension, you can use the regex '^[^.]+$' as a normal search pattern.
- -E, --exclude pattern
Exclude files/directories that match the given glob pattern. This overrides any other ignore logic. Multiple exclude patterns can be specified. Examples:
- --ignore-file path
Add a custom ignore-file in '.gitignore' format. These files have a low precedence.
- -c, --color when
Declare when to colorize search results:
Colorize output when standard output is connected to terminal (default).
Do not colorize output.
Always colorize output.
- -j, --threads num
Set number of threads to use for searching & executing (default: number of available CPU cores).
- -S, --size size
Limit results based on the size of files using the format <+-><NUM><UNIT>
file size must be greater than or equal to this
file size must be less than or equal to this
If neither '+' nor '-' is specified, file size must be exactly equal to this.
The numeric size (e.g. 500)
The units for NUM. They are not case-sensitive. Allowed unit values:
kilobytes (base ten, 10^3 = 1000 bytes)
kibibytes (base two, 2^10 = 1024 bytes)
- --changed-within date|duration
Filter results based on the file modification time. The argument can be provided as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). --change-newer-than can be used as an alias.
--change-newer-than "2018-10-27 10:00:00"
- --changed-before date|duration
Filter results based on the file modification time. The argument can be provided as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). --change-older-than can be used as an alias.
--changed-before "2018-10-27 10:00:00"
- -o, --owner [user][:group]
Filter files by their user and/or group. Format: [(user|uid)][:(group|gid)]. Either side is optional. Precede either side with a '!' to exclude files instead.
- --base-directory path
Change the current working directory of fd to the provided path. This means that search results will be shown with respect to the given base path. Note that relative paths which are passed to fd via the positional path argument or the --search-path option will also be resolved relative to this directory.
- --path-separator separator
Set the path separator to use when printinf file paths. The default is the OS-specific separator ('/' on Unix, '\' on Windows).
- --search-path search-path
Provide paths to search as an alternative to the positional path argument. Changes the usage to ´fd [FLAGS/OPTIONS] --search-path PATH --search-path PATH2 [PATTERN]´
- -x, --exec command
Execute command for each search result. The following placeholders are substituted by a path derived from the current search result:
path without file extension
basename without file extension
- -X, --exec-batch command
Execute command with all search results at once. A single occurence of the following placeholders is authorized and substituted by the paths derived from the search results before the command is executed:
path without file extension
basename without file extension
The regular expression syntax used by fd is documented here:
The glob syntax is documented here:
Determines how to colorize search results, see dircolors(1).
Disables colorized output.
- XDG_CONFIG_HOME, HOME
Used to locate the global ignore file. If XDG_CONFIG_HOME is set, use $XDG_CONFIG_HOME/fd/ignore. Otherwise, use $HOME/.config/fd/ignore.
- Find files and directories that match the pattern 'needle':
$ fd needle
- Start a search in a given directory (/var/log):
$ fd nginx /var/log
- Find all Python files (all files with the extention .py) in the current directory:
$ fd -e py
- Open all search results with vim:
$ fd pattern -X vim