sharkdp/fd
Configuration
fd has no configuration file. Every option is a CLI flag or an environment variable. This page is the canonical reference for both, plus the ignore-file locations fd reads.
The Config struct
Config lives in src/config.rs. Every field is set once by construct_config (src/main.rs) and read by the walker, filters, exec, and output subsystems. The fields are grouped here roughly by topic.
Search behaviour
| Field | CLI flag | Default | Notes |
|---|---|---|---|
case_sensitive |
-s/-i/(smart) |
smart | Smart case via pattern_has_uppercase_char. |
full_path_base |
-p, --full-path |
None |
When Some(cwd), patterns match against the absolute path. |
max_depth |
-d, --max-depth, --exact-depth |
None |
--exact-depth N sets both max_depth and min_depth to N. |
min_depth |
--min-depth, --mindepth |
None |
--mindepth is a hidden alias for --min-depth (10.3.0). |
prune |
--prune |
false |
When matching, do not descend into the matched directory. |
threads |
-j, --threads |
min(available_parallelism, 64) |
See default_num_threads in src/cli.rs. |
quiet |
-q, --quiet |
false |
Print nothing; exit 0 iff at least one match. |
max_buffer_time |
--max-buffer-time |
None (uses 100 ms default in walk.rs) |
Override the buffer-then-stream switchover. |
max_results |
--max-results, -1/--max-one-result |
None |
Stops the walker once reached. |
Ignore behaviour
| Field | CLI flag | Default | Notes |
|---|---|---|---|
ignore_hidden |
-H/--hidden, -u/--unrestricted |
true |
Skip dotfiles. |
read_fdignore |
-I/--no-ignore, -u |
true |
.ignore and .fdignore files. |
read_vcsignore |
-I, --no-ignore-vcs, -u |
true |
.gitignore, global gitignore, .git/info/exclude. |
require_git_to_read_vcsignore |
--no-require-git/--require-git |
true |
Only honour git rules inside a git repo. |
read_parent_ignore |
--no-ignore-parent/--ignore-parent |
true |
Walk up to ancestor directories looking for ignore files. |
read_global_ignore |
--no-global-ignore-file |
true |
Read ${etcetera::config_dir()}/fd/ignore. |
exclude_patterns |
-E, --exclude |
empty | Each pattern is prefixed with ! and fed to OverrideBuilder. |
ignore_files |
--ignore-file |
empty | Custom ignore files. |
ignore_contain |
--ignore-contain |
empty | Skip directories that contain a marker file. |
follow_links |
-L, --follow |
false |
Symlink-following walker. |
one_file_system |
--one-file-system, --mount |
false |
Refuse to cross filesystem boundaries. |
Filter constraints
| Field | CLI flag | Default | Source |
|---|---|---|---|
file_types |
-t, --type |
None |
src/filetypes.rs |
extensions |
-e, --extension |
None |
Compiled to a RegexSet. |
size_constraints |
-S, --size |
empty | Multiple may be specified; AND-merged. |
time_constraints |
--changed-within, --changed-before |
empty | Both may apply. |
owner_constraint |
-o, --owner (Unix only) |
None |
user:group, with ! for negation. |
Output
| Field | CLI flag | Default | Notes |
|---|---|---|---|
null_separator |
-0, --print0 |
false |
Use \0 between results and after exec output blocks. |
ls_colors |
-c auto/always/never |
Auto (terminal-aware) |
Falls back to bundled DEFAULT_LS_COLORS when env is unset. |
hyperlink |
--hyperlink[=auto/always/never] |
Auto (follows colors) |
OSC 8 hyperlinks. |
format |
--format |
None |
Output template (shares engine with --exec). |
path_separator |
--path-separator |
None |
On Windows must be one byte. |
actual_path_separator |
derived | path_separator.unwrap_or(MAIN_SEPARATOR) |
Used by the trailing-slash printer. |
strip_cwd_prefix |
--strip-cwd-prefix [auto/always/never] |
Auto |
Strip ./ from results when there's no positional search path and no exec/-0. |
Exec
| Field | CLI flag | Default | Notes |
|---|---|---|---|
command |
-x, -X, -l |
None |
Arc<CommandSet> (see src/exec/). |
batch_size |
--batch-size |
0 (no limit) |
Used by CommandBuilder to flush a batch. |
interactive_terminal |
derived | is_terminal(stdout) |
Used by output.rs for raw-bytes printing on Unix. |
show_filesystem_errors |
--show-errors |
false |
Emit traversal errors to stderr. |
Environment variables
| Variable | Effect |
|---|---|
LS_COLORS |
Used by LsColors::from_env to pick file colors. If unset, fd falls back to its bundled DEFAULT_LS_COLORS (see src/main.rs). |
NO_COLOR |
Disables coloured output unless --color=always. Implemented in construct_config. |
TERM |
Used on Windows to decide whether to attempt enable_ansi_support(). |
MSYSTEM |
If set on Windows, fd sets the default path separator to / (default_path_separator in src/filesystem.rs). |
XDG_CONFIG_HOME (and platform equivalents) |
Resolved by etcetera::choose_base_strategy() to find the global ignore file. |
CARGO_BIN_EXE_fd |
Set by Cargo for integration tests; consumed by tests/testenv/mod.rs to find the just-built binary. |
There is no FD_CONFIG or similar — fd intentionally has no project-level config file beyond the ignore files.
Ignore-file paths
| File | Location | Notes |
|---|---|---|
| Per-project | .gitignore, .ignore, .fdignore |
At any directory level; closer-to-the-file rules win. |
| Per-user | ${etcetera::config_dir()}/fd/ignore |
On Linux/macOS typically ~/.config/fd/ignore; on Windows %APPDATA%\fd\ignore. |
| Per-repo git | .git/info/exclude |
Honoured via WalkBuilder::git_exclude. |
| Global git | ~/.config/git/ignore (or core.excludesfile) |
Honoured via WalkBuilder::git_global. |
The exact rules come from the ignore crate. fd's only choice is whether to enable each source.
Locale and encoding
- fd does no locale-dependent matching. Smart case uses
char::is_uppercase, which is Unicode-aware. - Filenames are processed as bytes on Unix (
osstr_to_bytesreturns a borrowed slice viaOsStrExt::as_bytes) and as lossy UTF-8 on Windows. Patterns compile againstregex::bytes::Regex. - Output path printing on Unix prefers raw-byte writes when stdout is non-interactive and no path separator rewrite is requested, preserving non-UTF-8 names.
Exit code reference
See exit-codes.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.