Skip to content
Myr

README.md

This file

Path

README.md

790 lines · 27.5 KiB · Markdown

Last changed by

Merge pull request #2075 from cmelaro/fix-readme-exampleThayne McCombsbefore adoption41532d1

History of this file

Take it

Show it rendered

1# fd23[![CICD](https://github.com/sharkdp/fd/actions/workflows/CICD.yml/badge.svg)](https://github.com/sharkdp/fd/actions/workflows/CICD.yml)4[![Version info](https://img.shields.io/crates/v/fd-find.svg)](https://crates.io/crates/fd-find)5[[中文](https://github.com/cha0ran/fd-zh)]6[[한국어](https://github.com/spearkkk/fd-kor)]78`fd` is a program to find entries in your filesystem.9It is a simple, fast and user-friendly alternative to [`find`](https://www.gnu.org/software/findutils/).10While it does not aim to support all of `find`'s powerful functionality, it provides sensible11(opinionated) defaults for a majority of use cases.1213[Installation](#installation) • [How to use](#how-to-use) • [Troubleshooting](#troubleshooting)1415## Features1617* Intuitive syntax: `fd PATTERN` instead of `find -iname '*PATTERN*'`.18* Regular expression (default) and glob-based patterns.19* [Very fast](#benchmark) due to parallelized directory traversal.20* Uses colors to highlight different file types (same as `ls`).21* Supports [parallel command execution](#command-execution)22* Smart case: the search is case-insensitive by default. It switches to23  case-sensitive if the pattern contains an uppercase24  character[\*](http://vimdoc.sourceforge.net/htmldoc/options.html#'smartcase').25* Ignores hidden directories and files, by default.26* Ignores patterns from your `.gitignore`, by default.27* The command name is *50%* shorter[\*](https://github.com/ggreer/the_silver_searcher) than28  `find` :-).2930## Demo3132![Demo](doc/screencast.svg)3334## How to use3536First, to get an overview of all available command line options, you can either run37[`fd -h`](#command-line-options) for a concise help message or `fd --help` for a more detailed38version.3940### Simple search4142*fd* is designed to find entries in your filesystem. The most basic search you can perform is to43run *fd* with a single argument: the search pattern. For example, assume that you want to find an44old script of yours (the name included `netflix`):45``` bash46> fd netfl47Software/python/imdb-ratings/netflix-details.py48```49If called with just a single argument like this, *fd* searches the current directory recursively50for any entries that *contain* the pattern `netfl`.5152### Regular expression search5354The search pattern is treated as a regular expression. Here, we search for entries that start55with `x` and end with `rc`:56``` bash57> cd /etc58> fd '^x.*rc$'59X11/xinit/xinitrc60X11/xinit/xserverrc61```6263The regular expression syntax used by `fd` is [documented here](https://docs.rs/regex/latest/regex/#syntax).6465### Specifying the root directory6667If we want to search a specific directory, it can be given as a second argument to *fd*:68``` bash69> fd passwd /etc70/etc/default/passwd71/etc/pam.d/passwd72/etc/passwd73```7475### List all files, recursively7677*fd* can be called with no arguments. This is very useful to get a quick overview of all entries78in the current directory, recursively (similar to `ls -R`):79``` bash80> cd fd/tests81> fd82testenv83testenv/mod.rs84tests.rs85```8687If you want to use this functionality to list all files in a given directory, you have to use88a catch-all pattern such as `.` or `^`:89``` bash90> fd . fd/tests/91testenv92testenv/mod.rs93tests.rs94```9596### Searching for a particular file extension9798Often, we are interested in all files of a particular type. This can be done with the `-e` (or99`--extension`) option. Here, we search for all Markdown files in the fd repository:100``` bash101> cd fd102> fd -e md103CONTRIBUTING.md104README.md105```106107The `-e` option can be used in combination with a search pattern:108``` bash109> fd -e rs mod110src/fshelper/mod.rs111src/lscolors/mod.rs112tests/testenv/mod.rs113```114115### Searching for a particular file name116117 To find files with exactly the provided search pattern, use the `-g` (or `--glob`) option:118``` bash119> fd -g libc.so /usr120/usr/lib32/libc.so121/usr/lib/libc.so122```123124### Hidden and ignored files125By default, *fd* does not search hidden directories and does not show hidden files in the126search results. To disable this behavior, we can use the `-H` (or `--hidden`) option:127``` bash128> fd pre-commit129> fd -H pre-commit130.git/hooks/pre-commit.sample131```132133If we work in a directory that is a Git repository (or includes Git repositories), *fd* does not134search folders (and does not show files) that match one of the `.gitignore` patterns. To disable135this behavior, we can use the `-I` (or `--no-ignore`) option:136``` bash137> fd num_cpu138> fd -I num_cpu139target/debug/deps/libnum_cpus-f5ce7ef99006aa05.rlib140```141142To really search *all* files and directories, simply combine the hidden and ignore features to show143everything (`-HI`) or use `-u`/`--unrestricted`.144145### Matching the full path146By default, *fd* only matches the filename of each file. However, using the `--full-path` or `-p` option,147you can match against the full path.148149```bash150> fd -u -p -g '**/.git/config'151> fd -p '.*/lesson-\d+/[a-z]+.(jpg|png)'152```153154### Command execution155156Instead of just showing the search results, you often want to *do something* with them. `fd`157provides two ways to execute external commands for each of your search results:158159* The `-x`/`--exec` option runs an external command *for each of the search results* (in parallel).160* The `-X`/`--exec-batch` option launches the external command once, with *all search results as arguments*.161162#### Examples163164Recursively find all zip archives and unpack them:165``` bash166fd -e zip -x unzip167```168If there are two such files, `file1.zip` and `backup/file2.zip`, this would execute169`unzip file1.zip` and `unzip backup/file2.zip`. The two `unzip` processes run in parallel170(if the files are found fast enough).171172Find all `*.h` and `*.cpp` files and auto-format them inplace with `clang-format -i`:173``` bash174fd -e h -e cpp -x clang-format -i175```176Note how the `-i` option to `clang-format` can be passed as a separate argument. This is why177we put the `-x` option last.178179Any positional arguments after `-x` belong to the command template, not to `fd` itself. If you180also want to pass a pattern or search path, put `-x` last:181``` bash182fd pattern path -x echo183```184185Find all `test_*.py` files and open them in your favorite editor:186``` bash187fd -g 'test_*.py' -X vim188```189Note that we use capital `-X` here to open a single `vim` instance. If there are two such files,190`test_basic.py` and `lib/test_advanced.py`, this will run `vim test_basic.py lib/test_advanced.py`.191192To see details like file permissions, owners, file sizes etc., you can tell `fd` to show them193by running `ls` for each result:194``` bash195fd … -X ls -lhd --color=always196```197This pattern is so useful that `fd` provides a shortcut. You can use the `-l`/`--list-details`198option to execute `ls` in this way: `fd … -l`.199200The `-X` option is also useful when combining `fd` with [ripgrep](https://github.com/BurntSushi/ripgrep/) (`rg`) in order to search within a certain class of files, like all C++ source files:201```bash202fd -e cpp -e cxx -e h -e hpp -X rg 'std::cout'203```204205Convert all `*.jpg` files to `*.png` files:206``` bash207fd -e jpg -x convert {} {.}.png208```209Here, `{}` is a placeholder for the search result. `{.}` is the same, without the file extension.210See below for more details on the placeholder syntax.211212The terminal output of commands run from parallel threads using `-x` will not be interlaced or garbled,213so `fd -x` can be used to rudimentarily parallelize a task run over many files.214An example of this is calculating the checksum of each individual file within a directory.215``` bash216fd -tf -x md5sum > file_checksums.txt217```218219#### Placeholder syntax220221The `-x` and `-X` options take a *command template* as a series of arguments (instead of a single string).222If you want to add additional options to `fd` after the command template, you can terminate it with a `\;`.223224For example, `fd -x echo \; pattern path` treats `pattern path` as `fd` arguments instead of225passing them to `echo`. In practice, it is often clearer to write `fd pattern path -x echo`.226227The syntax for generating commands is similar to that of [GNU Parallel](https://www.gnu.org/software/parallel/):228229- `{}`: A placeholder token that will be replaced with the path of the search result230  (`documents/images/party.jpg`).231- `{.}`: Like `{}`, but without the file extension (`documents/images/party`).232- `{/}`: A placeholder that will be replaced by the basename of the search result (`party.jpg`).233- `{//}`: The parent of the discovered path (`documents/images`).234- `{/.}`: The basename, with the extension removed (`party`).235236If you do not include a placeholder, *fd* automatically adds a `{}` at the end.237238#### Parallel vs. serial execution239240For `-x`/`--exec`, you can control the number of parallel jobs by using the `-j`/`--threads` option.241Use `--threads=1` for serial execution.242243### Excluding specific files or directories244245Sometimes we want to ignore search results from a specific subdirectory. For example, we might246want to search all hidden files and directories (`-H`) but exclude all matches from `.git`247directories. We can use the `-E` (or `--exclude`) option for this. It takes an arbitrary glob248pattern as an argument:249``` bash250> fd -H -E .git …251```252253We can also use this to skip mounted directories:254``` bash255> fd -E /mnt/external-drive …256```257258.. or to skip certain file types:259``` bash260> fd -E '*.bak' …261```262263To make exclude-patterns like these permanent, you can create a `.fdignore` file. They work like264`.gitignore` files, but are specific to `fd`. For example:265``` bash266> cat ~/.fdignore267/mnt/external-drive268*.bak269```270271> [!NOTE]272> `fd` also supports `.ignore` files that are used by other programs such as `rg` or `ag`.273274If you want `fd` to ignore these patterns globally, you can put them in `fd`'s global ignore file.275This is usually located in `~/.config/fd/ignore` in macOS or Linux, and `%APPDATA%\fd\ignore` in276Windows.277278You may wish to include `.git/` in your `fd/ignore` file so that `.git` directories, and their contents279are not included in output if you use the `--hidden` option.280281### Deleting files282283You can use `fd` to remove all files and directories that are matched by your search pattern.284If you only want to remove files, you can use the `--exec-batch`/`-X` option to call `rm`. For285example, to recursively remove all `.DS_Store` files, run:286``` bash287> fd -H '^\.DS_Store$' -tf -X rm288```289If you are unsure, always call `fd` without `-X rm` first. Alternatively, use `rm`s "interactive"290option:291``` bash292> fd -H '^\.DS_Store$' -tf -X rm -i293```294295If you also want to remove a certain class of directories, you can use the same technique. You will296have to use `rm`s `--recursive`/`-r` flag to remove directories.297298> [!NOTE]299> There are scenarios where using `fd … -X rm -r` can cause race conditions: if you have a300path like `…/foo/bar/foo/…` and want to remove all directories named `foo`, you can end up in a301situation where the outer `foo` directory is removed first, leading to (harmless) *"'foo/bar/foo':302No such file or directory"* errors in the `rm` call.303304### Command-line options305306This is the output of `fd -h`. To see the full set of command-line options, use `fd --help` which307also includes a much more detailed help text.308309```310Usage: fd [OPTIONS] [pattern [path]...]311312Arguments:313  [pattern]  the search pattern (a regular expression, unless '--glob' is used; optional)314  [path]...  the root directories for the filesystem search (optional)315316Options:317  -H, --hidden                     Search hidden files and directories318  -I, --no-ignore                  Do not respect .(git|fd)ignore files319  -s, --case-sensitive             Case-sensitive search (default: smart case)320  -i, --ignore-case                Case-insensitive search (default: smart case)321  -g, --glob                       Glob-based search (default: regular expression)322  -a, --absolute-path              Show absolute instead of relative paths323  -l, --list-details               Use a long listing format with file metadata324  -L, --follow                     Follow symbolic links325  -p, --full-path                  Search full abs. path (default: filename only)326  -d, --max-depth <depth>          Set maximum search depth (default: none)327  -E, --exclude <glob>             Exclude entries that match the given glob pattern328  -t, --type <filetype>            Filter by type: file (f), directory (d/dir), symlink (l),329                                   executable (x), empty (e), socket (s), pipe (p), char-device330                                   (c), block-device (b)331  -e, --extension <ext>            Filter by extension332  -S, --size <size>                Limit results based on the size of files333      --changed-within <date|dur>  Filter by file modification time (newer than)334      --changed-before <date|dur>  Filter by file modification time (older than)335  -o, --owner <user:group>         Filter by owning user and/or group336      --format <fmt>               Print results according to template337  -x, --exec <cmd>...              Execute a command for each search result338  -X, --exec-batch <cmd>...        Execute a command with all search results at once339  -c, --color <when>               When to use colors [default: auto] [possible values: auto,340                                   always, never]341      --hyperlink[=<when>]         Add hyperlinks to output paths [default: never] [possible342                                   values: auto, always, never]343      --ignore-contain <name>      Ignore directories containing the named entry344  -h, --help                       Print help (see more with '--help')345  -V, --version                    Print version346```347348Note that options can be given after the pattern and/or path as well.349350## Benchmark351352Let's search my home folder for files that end in `[0-9].jpg`. It contains ~750,000353subdirectories and about a 4 million files. For averaging and statistical analysis, I'm using354[hyperfine](https://github.com/sharkdp/hyperfine). The following benchmarks are performed355with a "warm"/pre-filled disk-cache (results for a "cold" disk-cache show the same trends).356357Let's start with `find`:358```359Benchmark 1: find ~ -iregex '.*[0-9]\.jpg$'360  Time (mean ± σ):     19.922 s ±  0.109 s361  Range (min … max):   19.765 s … 20.065 s362```363364`find` is much faster if it does not need to perform a regular-expression search:365```366Benchmark 2: find ~ -iname '*[0-9].jpg'367  Time (mean ± σ):     11.226 s ±  0.104 s368  Range (min … max):   11.119 s … 11.466 s369```370371Now let's try the same for `fd`. Note that `fd` performs a regular expression372search by default. The options `-u`/`--unrestricted` option is needed here for373a fair comparison. Otherwise `fd` does not have to traverse hidden folders and374ignored paths (see below):375```376Benchmark 3: fd -u '[0-9]\.jpg$' ~377  Time (mean ± σ):     854.8 ms ±  10.0 ms378  Range (min … max):   839.2 ms … 868.9 ms379```380For this particular example, `fd` is approximately **23 times faster** than `find -iregex`381and about **13 times faster** than `find -iname`. By the way, both tools found the exact382same 546 files :smile:.383384**Note**: This is *one particular* benchmark on *one particular* machine. While we have385performed a lot of different tests (and found consistent results), things might386be different for you! We encourage everyone to try it out on their own. See387[this repository](https://github.com/sharkdp/fd-benchmarks) for all necessary scripts.388389Concerning *fd*'s speed, a lot of credit goes to the `regex` and `ignore` crates that are390also used in [ripgrep](https://github.com/BurntSushi/ripgrep) (check it out!).391392## Troubleshooting393394### `fd` does not find my file!395396Remember that `fd` ignores hidden directories and files by default. It also ignores patterns397from `.gitignore` files. If you want to make sure to find absolutely every possible file, always398use the options `-u`/`--unrestricted` option (or `-HI` to enable hidden and ignored files):399``` bash400> fd -u …401```402403Also remember that by default, `fd` only searches based on the filename and404doesn't compare the pattern to the full path. If you want to search based on the405full path (similar to the `-path` option of `find`) you need to use the `--full-path`406(or `-p`) option.407408### Colorized output409410`fd` can colorize files by extension, just like `ls`. In order for this to work, the environment411variable [`LS_COLORS`](https://linux.die.net/man/5/dir_colors) has to be set. Typically, the value412of this variable is set by the `dircolors` command which provides a convenient configuration format413to define colors for different file formats.414On most distributions, `LS_COLORS` should be set already. If you are on Windows or if you are looking415for alternative, more complete (or more colorful) variants, see [here](https://github.com/sharkdp/vivid),416[here](https://github.com/seebi/dircolors-solarized) or417[here](https://github.com/trapd00r/LS_COLORS).418419`fd` also honors the [`NO_COLOR`](https://no-color.org/) environment variable.420421### `fd` doesn't seem to interpret my regex pattern correctly422423A lot of special regex characters (like `[]`, `^`, `$`, ..) are also special characters in your424shell. If in doubt, always make sure to put single quotes around the regex pattern:425426``` bash427> fd '^[A-Z][0-9]+$'428```429430If your pattern starts with a dash, you have to add `--` to signal the end of command line431options. Otherwise, the pattern will be interpreted as a command-line option. Alternatively,432use a character class with a single hyphen character:433434``` bash435> fd -- '-pattern'436> fd '[-]pattern'437```438439### "Command not found" for `alias`es or shell functions440441Shell `alias`es and shell functions can not be used for command execution via `fd -x` or442`fd -X`. In `zsh`, you can make the alias global via `alias -g myalias="…"`. In `bash`,443you can use `export -f my_function` to make available to child processes. You would still444need to call `fd -x bash -c 'my_function "$1"' bash`. For other use cases or shells, use445a (temporary) shell script.446447### Placeholders in `-x`/`-X`448449Depending on your shell, you may need to quote the placeholders (`{}`, `{/}`, `{//}`,450`{.}`, `{/.}`) to prevent the shell from interpreting them before `fd` sees them.451452## Integration with other programs453454### Using fd with `fzf`455456You can use *fd* to generate input for the command-line fuzzy finder [fzf](https://github.com/junegunn/fzf):457``` bash458export FZF_DEFAULT_COMMAND='fd --type file'459export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"460```461462Then, you can type `vim <Ctrl-T>` on your terminal to open fzf and search through the fd-results.463464Alternatively, you might like to follow symbolic links and include hidden files (but exclude `.git` folders):465``` bash466export FZF_DEFAULT_COMMAND='fd --type file --follow --hidden --exclude .git'467```468469You can even use fd's colored output inside fzf by setting:470``` bash471export FZF_DEFAULT_COMMAND="fd --type file --color=always"472export FZF_DEFAULT_OPTS="--ansi"473```474475For more details, see the [Tips section](https://github.com/junegunn/fzf#tips) of the fzf README.476477### Using fd with `rofi`478479[*rofi*](https://github.com/davatorium/rofi) is a graphical launch menu application that is able to create menus by reading from *stdin*. Piping `fd` output into `rofi`s `-dmenu` mode creates fuzzy-searchable lists of files and directories.480481#### Example482483Create a case-insensitive searchable multi-select list of *PDF* files under your `$HOME` directory and open the selection with your configured PDF viewer. To list all file types, drop the `-e pdf` argument.484485``` bash486fd --type f -e pdf . $HOME | rofi -keep-right -dmenu -i -p FILES -multi-select | xargs -I {} xdg-open {}487```488489To modify the list that is presented by rofi, add arguments to the `fd` command. To modify the search behaviour of rofi, add arguments to the `rofi` command.490491### Using fd with `emacs`492493The emacs package [find-file-in-project](https://github.com/technomancy/find-file-in-project) can494use *fd* to find files.495496After installing `find-file-in-project`, add the line `(setq ffip-use-rust-fd t)` to your497`~/.emacs` or `~/.emacs.d/init.el` file.498499In emacs, run `M-x find-file-in-project-by-selected` to find matching files. Alternatively, run500`M-x find-file-in-project` to list all available files in the project.501502### Printing the output as a tree503504To format the output of `fd` as a file-tree you can use the `tree` command with505`--fromfile`:506```bash507❯ fd | tree --fromfile508```509510This can be more useful than running `tree` by itself because `tree` does not511ignore any files by default, nor does it support as rich a set of options as512`fd` does to control what to print:513```bash514❯ fd --extension rs | tree --fromfile515.516├── build.rs517└── src518    ├── app.rs519    └── error.rs520```521522On bash and similar you can simply create an alias:523```bash524❯ alias as-tree='tree --fromfile'525```526527### Using fd with `xargs` or `parallel`528529Note that `fd` has a builtin feature for [command execution](#command-execution) with530its `-x`/`--exec` and `-X`/`--exec-batch` options. If you prefer, you can still use531it in combination with `xargs`:532``` bash533> fd -0 -e rs | xargs -0 wc -l534```535Here, the `-0` option tells *fd* to separate search results by the NULL character (instead of536newlines). In the same way, the `-0` option of `xargs` tells it to read the input in this way.537538## Installation539540[![Packaging status](https://repology.org/badge/vertical-allrepos/fd-find.svg)](https://repology.org/project/fd-find/versions)541542### On Ubuntu543*... and other Debian-based Linux distributions.*544545If you run Ubuntu 19.04 (Disco Dingo) or newer, you can install the546[officially maintained package](https://packages.ubuntu.com/fd-find):547```548apt install fd-find549```550Note that the binary is called `fdfind` as the binary name `fd` is already used by another package.551It is recommended that after installation, you add a link to `fd` by executing command552`ln -s $(which fdfind) ~/.local/bin/fd`, in order to use `fd` in the same way as in this documentation.553Make sure that `$HOME/.local/bin` is in your `$PATH`.554555If you use an older version of Ubuntu, you can download the latest `.deb` package from the556[release page](https://github.com/sharkdp/fd/releases) and install it via:557``` bash558dpkg -i fd_9.0.0_amd64.deb # adapt version number and architecture559```560561Note that the .deb packages on the release page for this project still name the executable `fd`.562563### On Debian564565If you run Debian Buster or newer, you can install the566[officially maintained Debian package](https://tracker.debian.org/pkg/rust-fd-find):567```568apt-get install fd-find569```570Note that the binary is called `fdfind` as the binary name `fd` is already used by another package.571It is recommended that after installation, you add a link to `fd` by executing command572`ln -s $(which fdfind) ~/.local/bin/fd`, in order to use `fd` in the same way as in this documentation.573Make sure that `$HOME/.local/bin` is in your `$PATH`.574575Note that the .deb packages on the release page for this project still name the executable `fd`.576577### On Fedora578579Starting with Fedora 28, you can install `fd` from the official package sources:580``` bash581dnf install fd-find582```583584### On Alpine Linux585586You can install [the fd package](https://pkgs.alpinelinux.org/packages?name=fd)587from the official sources, provided you have the appropriate repository enabled:588```589apk add fd590```591592### On Arch Linux593594You can install [the fd package](https://www.archlinux.org/packages/extra/x86_64/fd/) from the official repos:595```596pacman -S fd597```598You can also install fd [from the AUR](https://aur.archlinux.org/packages/fd-git).599600### On Gentoo Linux601602You can use [the fd ebuild](https://packages.gentoo.org/packages/sys-apps/fd) from the official repo:603```604emerge -av fd605```606607### On openSUSE Linux608609You can install [the fd package](https://software.opensuse.org/package/fd) from the official repo:610```611zypper in fd612```613614### On Void Linux615616You can install `fd` via xbps-install:617```618xbps-install -S fd619```620621### On ALT Linux622623You can install [the fd package](https://packages.altlinux.org/en/sisyphus/srpms/fd/) from the official repo:624```625apt-get install fd626```627628### On Solus629630You can install [the fd package](https://github.com/getsolus/packages/tree/main/packages/f/fd) from the official repo:631```632eopkg install fd633```634635### On RedHat Enterprise Linux (RHEL) 8/9/10, Almalinux 8/9/10, EuroLinux 8/9 or Rocky Linux 8/9/10636637You can install [the `fd` package](https://copr.fedorainfracloud.org/coprs/tkbcopr/fd/) from Fedora Copr.638639```bash640dnf copr enable tkbcopr/fd641dnf install fd642```643644A different version using the [slower](https://github.com/sharkdp/fd/pull/481#issuecomment-534494592) malloc [instead of jemalloc](https://bugzilla.redhat.com/show_bug.cgi?id=2216193#c1) is also available from the EPEL8/9 repo as the package `fd-find`.645646### On macOS647648You can install `fd` with [Homebrew](https://formulae.brew.sh/formula/fd):649```650brew install fd651```652653… or with MacPorts:654```655port install fd656```657658### On Windows659660You can download pre-built binaries from the [release page](https://github.com/sharkdp/fd/releases).661662Alternatively, you can install `fd` via [Scoop](http://scoop.sh):663```664scoop install fd665```666667Or via [Chocolatey](https://chocolatey.org):668```669choco install fd670```671672Or via [Winget](https://learn.microsoft.com/en-us/windows/package-manager/):673```674winget install sharkdp.fd675```676677### On GuixOS678679You can install [the fd package](https://guix.gnu.org/en/packages/fd-8.1.1/) from the official repo:680```681guix install fd682```683684### On Mise685686You can use [mise](https://github.com/jdx/mise) to install `fd` with a command like this:687```688mise use -g fd@latest689```690691### On NixOS / via Nix692693You can use the [Nix package manager](https://nixos.org/nix/) to install `fd`:694```695nix-env -i fd696```697698### Via Flox699700You can use [Flox](https://flox.dev) to install `fd` into a Flox environment:701```702flox install fd703```704705### On FreeBSD706707You can install [the fd-find package](https://www.freshports.org/sysutils/fd) from the official repo:708```709pkg install fd-find710```711712### From npm713714On Linux and macOS, you can install the [fd-find](https://npm.im/fd-find) package:715716```717npm install -g fd-find718```719720### From source721722With Rust's package manager [cargo](https://github.com/rust-lang/cargo), you can install *fd* via:723```724cargo install fd-find725```726Note that rust version *1.90.0* or later is required.727728`make` is also needed for the build.729730### From binaries731732The [release page](https://github.com/sharkdp/fd/releases) includes precompiled binaries for Linux, macOS and Windows. Statically-linked binaries are also available: look for archives with `musl` in the file name.733734## Development735```bash736git clone https://github.com/sharkdp/fd737738# Build739cd fd740cargo build741742# Run unit tests and integration tests743cargo test744745# Install746cargo install --path .747```748749### Completions750751#### From Release Archives752753Pre-built completion files are included in the release archives (`.tar.gz`/`.zip`) on the754[Releases page](https://github.com/sharkdp/fd/releases), in the `autocomplete` directory.755To use these completions:756757- **bash**: Source the `fd.bash` file in your `~/.bashrc`, or place it in a directory that gets sourced automatically.758- **zsh**: Move `_fd` to a directory in your `fpath` (e.g., `~/.zfunc`).759- **fish**: Copy `fd.fish` to `~/.config/fish/completions/`.760- **powershell**: Source `_fd.ps1` from one of your [profile scripts](https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/creating-profiles?view=powershell-7.5).761762#### Generate from fd763764You can also generate completions directly using `fd --gen-completions <shell>`:765766```bash767# Bash768fd --gen-completions bash > ~/.local/share/bash-completion/completions/fd769770# Zsh (ensure ~/.zfunc is in your fpath)771fd --gen-completions zsh > ~/.zfunc/_fd772773# Fish774fd --gen-completions fish > ~/.config/fish/completions/fd.fish775776# PowerShell777fd --gen-completions powershell >> $PROFILE778```779780## Maintainers781782- [sharkdp](https://github.com/sharkdp)783- [tmccombs](https://github.com/tmccombs)784- [tavianator](https://github.com/tavianator)785786## License787788`fd` is distributed under the terms of both the MIT License and the Apache License 2.0.789790See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.