Skip to content
Myr

fd.1

This file

Path

doc/fd.1

306 lines · 7.7 KiB

Last changed by

Update --size documentationsharkdpbefore adoptione3c77ef

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.IR .ignore ,37.IR .fdignore ,38or the global ignore file.39.TP40.B \-u, \-\-unrestricted41Alias for '--no-ignore'. Can be repeated; '-uu' is an alias for '--no-ignore --hidden'.42.TP43.B \-\-no\-ignore\-vcs44Show search results from files and directories that would otherwise be ignored by45.I .gitignore46files.47.TP48.B \-s, \-\-case\-sensitive49Perform a case-sensitive search. By default, fd uses case-insensitive searches, unless the50pattern contains an uppercase character (smart case).51.TP52.B \-i, \-\-ignore\-case53Perform a case-insensitive search. By default, fd uses case-insensitive searches, unless the54pattern contains an uppercase character (smart case).55.TP56.B \-g, \-\-glob57Perform a glob-based search instead of a regular expression search.58.TP59.B \-\-regex60Perform a regular-expression based seach (default). This can be used to override --glob.61.TP62.B \-F, \-\-fixed\-strings63Treat the pattern as a literal string instead of a regular expression.64.TP65.B \-a, \-\-absolute\-path66Shows the full path starting from the root as opposed to relative paths.67.TP68.B \-l, \-\-list\-details69Use a detailed listing format like 'ls -l'. This is basically an alias70for '--exec-batch ls -l' with some additional 'ls' options. This can be used71to see more metadata, to show symlink targets and to achieve a deterministic72sort order.73.TP74.B \-L, \-\-follow75By default, fd does not descend into symlinked directories. Using this flag, symbolic links are76also traversed.77.TP78.B \-p, \-\-full\-path79By default, the search pattern is only matched against the filename (or directory name). Using80this flag, the81.I pattern82is matched against the full path.83.TP84.B \-0, \-\-print085Separate search results by the null character (instead of newlines). Useful for piping results to86.IR xargs .87.TP88.B \-\-max\-results count89Limit the number of search results to 'count' and quit immediately.90.TP91.B \-192Limit the search to a single result and quit immediately. This is an alias for '--max-results=1'.93.TP94.B \-\-show-errors95Enable the display of filesystem errors for situations such as insufficient96permissions or dead symlinks.97.TP98.B \-\-one\-file\-system, \-\-mount, \-\-xdev99By 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).100.TP101.B \-h, \-\-help102Print help information.103.TP104.B \-V, \-\-version105Print version information.106.TP107.BI "\-d, \-\-max\-depth " d108Limit directory traversal to at most109.I d110levels of depth. By default, there is no limit on the search depth.111.TP112.BI "\-\-min\-depth " d113Only show search results starting at the given depth. See also: '--max-depth' and '--exact-depth'.114.TP115.BI "\-\-exact\-depth " d116Only show search results at the exact given depth. This is an alias for '--min-depth <depth> --max-depth <depth>'.117.TP118.BI "\-t, \-\-type " filetype119Filter search by type:120.RS121.IP "f, file"122regular files123.IP "d, directory"124directories125.IP "l, symlink"126symbolic links127.IP "x, executable"128executable (files)129.IP "e, empty"130empty files or directories131.IP "s, socket"132sockets133.IP "p, pipe"134named pipes (FIFOs)135.RE136137.RS138This option can be used repeatedly to allow for multiple file types.139.RE140.TP141.BI "\-e, \-\-extension " ext142Filter search results by file extension143.IR ext .144This option can be used repeatedly to allow for multiple possible file extensions.145.TP146.BI "\-E, \-\-exclude " pattern147Exclude files/directories that match the given glob pattern.148This overrides any other ignore logic.149Multiple exclude patterns can be specified.150.TP151.BI "\-\-ignore-file " path152Add a custom ignore-file in '.gitignore' format.153These files have a low precedence.154.TP155.BI "\-c, \-\-color " when156Declare157.I when158to colorize search results:159.RS160.IP auto161Colorize output when standard output is connected to terminal (default).162.IP never163Do not colorize output.164.IP always165Always colorize output.166.RE167.TP168.BI "\-j, \-\-threads " num169Set number of threads to use for searching & executing (default: number of available CPU cores).170.TP171.BI "\-S, \-\-size " size172Limit results based on the size of files using the format173.I <+-><NUM><UNIT>174.RS175.IP '+'176file size must be greater than or equal to this177.IP '-'178file size must be less than or equal to this179.IP 'NUM'180The numeric size (e.g. 500)181.IP 'UNIT'182The units for NUM. They are not case-sensitive.183Allowed unit values:184.RS185.IP 'b'186bytes187.IP 'k'188kilobytes (base ten, 10^3 = 1000 bytes)189.IP 'm'190megabytes191.IP 'g'192gigabytes193.IP 't'194terabytes195.IP 'ki'196kibibytes (base two, 2^10 = 1024 bytes)197.IP 'mi'198mebibytes199.IP 'gi'200gibibytes201.IP 'ti'202tebibytes203.RE204.RE205.TP206.BI "\-\-changed-within " date|duration207Filter results based on the file modification time. The argument can be provided as a specific208point in time (\fIYYYY-MM-DD HH:MM:SS\fR) or as a duration (\fI10h, 1d, 35min\fR).209.B --change-newer-than210can be used as an alias.211212Examples:213  \-\-changed-within 2weeks214  \-\-change-newer-than "2018-10-27 10:00:00"215.TP216.BI "\-\-changed-before " date|duration217Filter results based on the file modification time. The argument can be provided as a specific218point in time (\fIYYYY-MM-DD HH:MM:SS\fR) or as a duration (\fI10h, 1d, 35min\fR).219.B --change-older-than220can be used as an alias.221222Examples:223  \-\-changed-before "2018-10-27 10:00:00"224  \-\-change-older-than 2weeks225.TP226.BI "-o, \-\-owner " [user][:group]227Filter files by their user and/or group. Format: [(user|uid)][:(group|gid)]. Either side228is optional. Precede either side with a '!' to exclude files instead.229230Examples:231  \-\-owner john232  \-\-owner :students233  \-\-owner "!john:students"234.TP235.BI "\-x, \-\-exec " command236Execute237.I command238for each search result. The following placeholders are substituted by a path derived from the current search result:239.RS240.IP {}241path242.IP {/}243basename244.IP {//}245parent directory246.IP {.}247path without file extension248.IP {/.}249basename without file extension250.RE251.TP252.BI "\-X, \-\-exec-batch " command253Execute254.I command255with all search results at once.256A single occurence of the following placeholders is authorized and substituted by the paths derived from the search results before the command is executed:257.RS258.IP {}259path260.IP {/}261basename262.IP {//}263parent directory264.IP {.}265path without file extension266.IP {/.}267basename without file extension268.RE269.SH PATTERN SYNTAX270The regular expression syntax used by fd is documented here:271272.UR https://docs.rs/regex/1.0.0/regex/#syntax273.UE274275The glob syntax is documented here:276277.UR https://docs.rs/globset/#syntax278.UE279.SH ENVIRONMENT280.TP281.B LS_COLORS282Determines how to colorize search results, see283.BR dircolors (1) .284.TP285.B XDG_CONFIG_HOME, HOME286Used to locate the global ignore file. If287.B XDG_CONFIG_HOME288is set, use289.IR $XDG_CONFIG_HOME/fd/ignore .290Otherwise, use291.IR $HOME/.config/fd/ignore .292.SH EXAMPLES293.TP294.RI "Find files and directories that match the pattern '" needle "':"295$ fd needle296.TP297.RI "Start a search in a given directory (" /var/log "):"298$ fd nginx /var/log299.TP300.RI "Find all Python files (all files with the extention " .py ") in the current directory:"301$ fd -e py302.TP303.RI "Open all search results with vim:"304$ fd pattern -X vim305.SH SEE ALSO306.BR find (1)