find
-like, search for files in a directory hierarchy.
Features:
- Multithreaded and efficient (faster than
find
andfd
) - Mostly intuitive, and simple interface
Usage:
f [optional-params] [input: string...]
Arguments:
Entered `input` may be a pattern OR a path to search.
The pattern will only match with the filename unless you include a "/".
"/" and "$" also match the start and end of a path.
Options:
-h, --help print this cligen-erated help
--help-syntax advanced: prepend,plurals,..
--version bool false print version
-a, --all bool false Search all directories, including those ignored by default/your ".config/nimf/ignore.csv" file.
-x=, --exclude= strings {} Add patterns to ignore.
-t=, --types= filetypes any Select which file type(s) to match. File type may be any|{l}file|{l}directory|{f/d}link or a file extension.
-e=, --execute= strings {} Execute a command for each matching search result in parallel.
Alternatively, end this argument with "+" to execute the command once with all results as arguments.
Example: f .nim -e "$EDITOR"+
The following placeholders are substituted before the command is executed:
"{}": path (of the current search result)
"{/}": basename
"{//}": parent directory
"{.}": path without file extension
"{/.}": basename without file extension
Example: f .jpg$ -e 'convert {} {.}.png'
If no placeholder is present, an implicit " {}" at the end is assumed.
-d=, --max-depth= int 0 Set a maximum of how deep in the directory tree to search.
-l=, --limit= int/ms/s 0 Limit the search to a number of results, alternatively end this argument with "ms" or "s" to limit the search based on time.
-L, --follow-symlinks bool false Enable traversing symlinks.
-0, --null bool false Separate search results (stdout) and split stdin with null characters "\0" instead of newlines "\n".
-c, --color flag auto Enable or disable colored printing. Default is based on the "NO_COLOR" environment variable.
--hyperlink flag false Enable clickable hyperlinks in supported terminals.
No pattern | 231,970 matches | |
---|---|---|
f -ac=never | 0.95s | 0.55s |
fd -uc=never | 1.10s | 0.73s |
f -a | 1.17s | 0.84s |
find | 1.23s | 0.96s |
fd -u | 1.29s | 0.96s |
No pattern | 1,028,205 matches | 14,075 matches | |
---|---|---|---|
f -a | 6.91s | 4.16s | 0.38s |
find | 7.30s | 4.83s | 1.25s |
fd -u | 9.62s | 4.92s | 0.96s |
No pattern | 2,241,660 matches | 3 matches | |
---|---|---|---|
f -a | 13.59s | 9.54s | 0.65s |
find | 15.32s | 10.88s | 2.68s |
fd1 | 25.16s | 11.32s | N/A |
Footnotes
-
These measurements may be inaccurate,
fd
would not stop searching my drive (and pinning my CPU) so I had to watch for when it stopped printing results and ^C.
As the 3 matches search finished printing its results much earlier than it finished searching, I could not measure it. But for brevity,fd
(when lucky) finished printing the 3 results in around 1.5s. With this same measuring,f
finishes in around 0.35s andfind
around 0.7s. ↩