Skip to content
Myr

fd.1

This file

Path

doc/fd.1

290 lines · 7.2 KiB

Last changed by

Add new `--type socket` and `--type pipe` filterssharkdpbefore adoptioncb56add

History of this file

Take it

1.TH FD 12.SH NAME3fd \- find entries in the filesystem4.SH SYNOPSIS5.B fd6.RB [ \-HIEsiaLp0hV ]7.RB [ \-d8.IR depth ]9.RB [ \-t10.IR filetype ]11.RB [ \-e12.IR ext ]13.RB [ \-E14.IR exclude ]15.RB [ \-c16.IR when ]17.RB [ \-j18.IR num ]19.RB [ \-x20.IR cmd ]21.RI [ pattern ]22.RI [ path... ]23.SH DESCRIPTION24.B fd25is a simple, fast and user-friendly alternative to26.BR find (1).27.SH OPTIONS28.TP29.B \-H, \-\-hidden30Include hidden files and directories in the search results31(default: hidden files and directories are skipped).32.TP33.B \-I, \-\-no\-ignore34Show search results from files and directories that would otherwise be ignored by35.IR .gitignore ,36.I .ignore37or38.I .fdignore39files.40.TP41.B \-u, \-\-unrestricted42Alias for '--no-ignore'. Can be repeated; '-uu' is an alias for '--no-ignore --hidden'.43.TP44.B \-\-no\-ignore\-vcs45Show search results from files and directories that would otherwise be ignored by46.I .gitignore47files.48.TP49.B \-s, \-\-case\-sensitive50Perform a case-sensitive search. By default, fd uses case-insensitive searches, unless the51pattern contains an uppercase character (smart case).52.TP53.B \-i, \-\-ignore\-case54Perform a case-insensitive search. By default, fd uses case-insensitive searches, unless the55pattern contains an uppercase character (smart case).56.TP57.B \-g, \-\-glob58Perform a glob-based search instead of a regular expression search.59.TP60.B \-\-regex61Perform a regular-expression based seach (default). This can be used to override --glob.62.TP63.B \-F, \-\-fixed\-strings64Treat the pattern as a literal string instead of a regular expression.65.TP66.B \-a, \-\-absolute\-path67Shows the full path starting from the root as opposed to relative paths.68.TP69.B \-l, \-\-list\-details70Use a detailed listing format like 'ls -l'. This is basically an alias71for '--exec-batch ls -l' with some additional 'ls' options. This can be used72to see more metadata, to show symlink targets and to achieve a deterministic73sort order.74.TP75.B \-L, \-\-follow76By default, fd does not descend into symlinked directories. Using this flag, symbolic links are77also traversed.78.TP79.B \-p, \-\-full\-path80By default, the search pattern is only matched against the filename (or directory name). Using81this flag, the82.I pattern83is matched against the full path.84.TP85.B \-0, \-\-print086Separate search results by the null character (instead of newlines). Useful for piping results to87.IR xargs .88.TP89.B \-\-max\-results count90Limit the number of search results to 'count' and quit immediately.91.TP92.B \-193Limit the search to a single result and quit immediately. This is an alias for '--max-results=1'.94.TP95.B \-\-show-errors96Enable the display of filesystem errors for situations such as insufficient97permissions or dead symlinks.98.TP99.B \-\-one\-file\-system, \-\-mount, \-\-xdev100By 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).101.TP102.B \-h, \-\-help103Print help information.104.TP105.B \-V, \-\-version106Print version information.107.TP108.BI "\-d, \-\-max\-depth " d109Limit directory traversal to at most110.I d111levels of depth. By default, there is no limit on the search depth.112.TP113.BI "\-\-min\-depth " d114Only show search results starting at the given depth. See also: '--max-depth' and '--exact-depth'.115.TP116.BI "\-\-exact\-depth " d117Only show search results at the exact given depth. This is an alias for '--min-depth <depth> --max-depth <depth>'.118.TP119.BI "\-t, \-\-type " filetype120Filter search by type:121.RS122.IP "f, file"123regular files124.IP "d, directory"125directories126.IP "l, symlink"127symbolic links128.IP "x, executable"129executable (files)130.IP "e, empty"131empty files or directories132.IP "s, socket"133sockets134.IP "p, pipe"135named pipes (FIFOs)136.RE137138.RS139This option can be used repeatedly to allow for multiple file types.140.RE141.TP142.BI "\-e, \-\-extension " ext143Filter search results by file extension144.IR ext .145This option can be used repeatedly to allow for multiple possible file extensions.146.TP147.BI "\-E, \-\-exclude " pattern148Exclude files/directories that match the given glob pattern.149This overrides any other ignore logic.150Multiple exclude patterns can be specified.151.TP152.BI "\-\-ignore-file " path153Add a custom ignore-file in '.gitignore' format.154These files have a low precedence.155.TP156.BI "\-c, \-\-color " when157Declare158.I when159to colorize search results:160.RS161.IP auto162Colorize output when standard output is connected to terminal (default).163.IP never164Do not colorize output.165.IP always166Always colorize output.167.RE168.TP169.BI "\-j, \-\-threads " num170Set number of threads to use for searching & executing (default: number of available CPU cores).171.TP172.BI "\-S, \-\-size " size173Limit results based on the size of files using the format174.I <+-><NUM><UNIT>175.RS176.IP '+'177file size must be greater than or equal to this178.IP '-'179file size must be less than or equal to this180.IP 'NUM'181The numeric size (e.g. 500)182.IP 'UNIT'183The units for NUM. They are not case-sensitive.184Allowed unit values:185.RS186.IP 'b'187bytes188.IP 'k'189kilobytes190.IP 'm'191megabytes192.IP 'g'193gigabytes194.IP 't'195terabytes196.IP 'ki'197kibibytes198.IP 'mi'199mebibytes200.IP 'gi'201gibibytes202.IP 'ti'203tebibytes204.RE205.RE206.TP207.BI "\-\-changed-within " date|duration208Filter results based on the file modification time. The argument can be provided as a specific209point in time (\fIYYYY-MM-DD HH:MM:SS\fR) or as a duration (\fI10h, 1d, 35min\fR).210.B --change-newer-than211can be used as an alias.212213Examples:214  \-\-changed-within 2weeks215  \-\-change-newer-than "2018-10-27 10:00:00"216.TP217.BI "\-\-changed-before " date|duration218Filter results based on the file modification time. The argument can be provided as a specific219point in time (\fIYYYY-MM-DD HH:MM:SS\fR) or as a duration (\fI10h, 1d, 35min\fR).220.B --change-older-than221can be used as an alias.222223Examples:224  \-\-changed-before "2018-10-27 10:00:00"225  \-\-change-older-than 2weeks226.TP227.BI "\-x, \-\-exec " command228Execute229.I command230for each search result. The following placeholders are substituted by a path derived from the current search result:231.RS232.IP {}233path234.IP {/}235basename236.IP {//}237parent directory238.IP {.}239path without file extension240.IP {/.}241basename without file extension242.RE243.TP244.BI "\-X, \-\-exec-batch " command245Execute246.I command247with all search results at once.248A single occurence of the following placeholders is authorized and substituted by the paths derived from the search results before the command is executed:249.RS250.IP {}251path252.IP {/}253basename254.IP {//}255parent directory256.IP {.}257path without file extension258.IP {/.}259basename without file extension260.RE261.SH PATTERN SYNTAX262The regular expression syntax used by fd is documented here:263264.UR https://docs.rs/regex/1.0.0/regex/#syntax265.UE266267The glob syntax is documented here:268269.UR https://docs.rs/globset/#syntax270.UE271.SH ENVIRONMENT272.TP273.B LS_COLORS274Determines how to colorize search results, see275.BR dircolors (1) .276.SH EXAMPLES277.TP278.RI "Find files and directories that match the pattern '" needle "':"279$ fd needle280.TP281.RI "Start a search in a given directory (" /var/log "):"282$ fd nginx /var/log283.TP284.RI "Find all Python files (all files with the extention " .py ") in the current directory:"285$ fd -e py286.TP287.RI "Open all search results with vim:"288$ fd pattern -X vim289.SH SEE ALSO290.BR find (1)