A Friendly Alternative Tool for find in Linux of fd Command

  • 2021-07-09 09:47:40
  • OfStack

The fd command provides a simple and straightforward way to search the Linux file system.

fd is an ultra-fast, Rust-based replacement for the Unix/Linux find command. It does not provide all the powerful functions of find. However, it does provide enough functionality to cover 80% of the situations you may encounter. Features such as good planning and convenient syntax, color output, smart case, regular expressions, and parallel command execution make fd a very capable successor.


Go to the fd GitHub page to see the installation section. It covers how to install programs on macOS, Debian/Ubuntu, Red, Hat, and Arch, Linux. After installation, you can get a complete overview of all available command-line options by running Help, concise Help through fd-h, or more detailed Help through fd-help.

Simple search

fd is designed to help you easily find files and folders in your file system. You can use fd to perform the simplest search with a parameter, which is anything you want to search for. For example, suppose you want to find an Markdown document that contains the word services as part 1 of the filename:

$ fd services

If called with only one parameter, fd recursively searches the current directory for any files and/or directories that match Mo's parameters. The equivalent search using the built-in find command is as follows:

$ find . -name 'services'

As you can see, fd is much simpler and requires less input. It's always right in my mind to do more with less input.

Files and folders

You can use the-t parameter to limit the search to files or directories, followed by letters representing what you want to search for. For example, to find all files in the current directory that contain services in their filenames, use:

$ fd -tf services

And, find all directories in the current directory that contain services in the file name:

$ fd -td services

How do I list all documents with the. md extension in the current folder?

$ fd .md

As you can see from the output, fd can not only find and list files in the current folder, but also find files in subfolders. It's simple.

You can even use the-H parameter to search for hidden files:

fd -H sessions .

Specify a directory

If you want to search for a specific directory, the name of this directory can be passed to fd as the second parameter:

$ fd passwd /etc

In this example, we tell fd that we want to search the etc directory for all instances of the word passwd.

Global search

What if you know part 1 of the file name but don't know the folder? Suppose you download a book about Linux network management, but you don't know where it is saved. No problem:

fd Administration /
/Users/pmullins/Documents/Books/Linux/Mastering Linux Network Administration.epub


fd is an excellent alternative to the find command, and I'm sure you and I will find it useful. To learn more about this command, just browse the man page.

Related articles: