fd, is a simple, fast and user-friendly tool meant to simply perform faster compared to find. It is not meant to completely replace find, but rather give you an easy to use an alternative that performs slightly faster.


Some of the notable features of fd:

  • Easy to use syntax – fd *pattern* instead of find -iname *pattern*.
  • Colourful output similar to the one of ls command.
  • Fast performance. Developer’s benchmarks are available here.
  • Smart search with case-insensitive by default and switches to case sensitive if patter containers an uppercase symbol.
  • Does not look in hidden files and directories by default.
  • Does not look into .gitignore by default.
  • Unicode awareness.


How to Install fd in Linux


We are going to look at how to install fd in different Linux distributios.


For Ubuntu and Debian based distros, you will need to download the latest fd version from the release page and install it using following commands.

$ wget https://github.com/sharkdp/fd/releases/download/v7.3.0/fd-musl_7.3.0_amd64.deb
$ sudo dpkg -i fd-musl_7.3.0_amd64.deb


On Other Linux distributions, you can install fd from the default repository using package manager as shown.

# dnf install fd-find  [On Fedora]
# pacman -S fd         [On Arch Linux]
# emerge -av fd        [On Gentoo]
# zypper in fd         [On OpenSuse]


How to Use fd in Linux


Similar to find command, fd has many uses cases, but let’s start at checking the available options:

# fd -h
# fd --help


You can run fd without any arguments, the output is very similar to ls -R command.

# fd


You can run fd to search for different files and folders located in /var/www/html/.

# fd | head


Let’s say we want to find all jpg files. We can use the “-e” flag to filter by file extension:

# fd -e jpg


The “-e” flag can be used in combination with a pattern like this:

# fd -e php index


The above command will look for files with extension php and have the string “index” in them


If you want to exclude some results, you can use the “-E” flag like this:

# fd -e php index -E wp-content


This command will look for all files with php extension, containing the string “index” and will exclude results from the “wp-content” directory.


If you want to specify a search directory, you simply need to give it as an argument:

# fd <pattery> <directory>


Just as find, you can use -x or --exec arguments to perform parallel command execution with the search results.


Here is an example where we will use chmod to change permissions of the image files

# fd -e jpg -x chmod 644 {}


The above will find all files with extension jpg and will run chmod 644 <path-to-file>.


Here, is some useful explanation and usage of the brackets:

  • {} – A placeholder which will be changed with the path of the search result (wp-content/uploads/01.jpg).
  • {.} – similar to {}, but without using the file extension (wp-content/uploads/01).
  • {/} – A placeholder that will be replaced by the basename of the search result (01.jpg).
  • {//}  Parent directory of the discovered path (wp-content/uploads).
  • {/.}  Only the basename, without the extension (01).


Was this answer helpful? 0 Users Found This Useful (0 Votes)