Finding files in the terminal is a pain. It's slow, and the find command requires very specific arguments to ensure you locate the file you're looking for.

fd is designed to be a simple, quick, intuitive, and easy-to-use replacement for the find command. Here's how to install and use fd on Linux.

Finding Files Is Frustrating on Linux

man in a white coat searching through filing cabinets

The Linux filesystem can be a sprawling mess of disorganized files and directories—especially if you're the kind of person who downloads and unzips files, and clones GitHub projects without keeping track of what goes where.

The find command should be familiar to every user, but mastering find on Linux takes work, and some would argue that it's both slower and less intuitive than it could be.

find accepts arguments in the form:

        find [path] [options] [expression]
    

If you remember that the name of a file is "foo" and you're fairly sure it's somewhere in your home directory, you would enter:

        find ~ -type f -name "foo"
    

This command is three words longer than it truly needs to be, and the related man page runs to over 9,000 words.

fd Is a Faster and More Intuitive Find Alternative

hand pushing a red pin into a map

Most of the time, when you want to find something, you're looking for a file. You shouldn't need to specify that it's a file, and you shouldn't need to explicitly state that you're searching for it by name.

The developers of fd understand this and have made their command-line app so that it will accept the filename as an argument, then quickly and efficiently deliver that file to you without fuss. Of course, on rare occasions when your needs are more complex than this, it will also accept a range of arguments.

fd is also faster than the native Linux "find" command, and in our tests, took around half as long to return the result we were looking for.

How to Install fd on Linux

The first thing you need to know before you install fd is that it isn't really this app's name. In most default Linux repositories, including Ubuntu's, "fd" is a completely different package.

The binary for the app is called "fdfind", while the package stored in some repositories is called "fd-find". The developers have unofficially renamed it "fd" as it's super quick to type into your terminal.

If you're on a recent version of Ubuntu or Debian, you can install the app by entering:

        sudo apt install fd-find
    

Alternatively, if your distro is part of the Arch ecosystem, run:

        sudo pacman -S fd
    

Or if it's part of the Fedora family:

        dnf install fd-find
    

You can alias it to "fd" for all users with:

        sudo ln -s /usr/bin/fdfind /usr/bin/fd
    

Use fd to Find Files on Linux

The point of fd is to simplify search and to this end, if you want to find a file called "foo", which is hidden in a subdirectory of your working directory, you would enter:

        fd foo
    

It returns the results almost instantly.

If you want to search for a location other than your working directory, add the path after your search pattern. For instance:

        fd foo /
    

Not knowing the exact name isn't a hindrance to finding files with fd, as it treats search patterns as regular expressions. The following command will locate all files which start with "f" and end with "o":

        fd '^f.*o$'
    

fd accepts arguments after the pattern. Some useful arguments are:

  • -H: Search hidden files and directories
  • -L: Follow symbolic links
  • -e: Filter by file extension

For a complete list of arguments, consult the fd README on its GitHub page.

Keep Your Files Organized on Linux

While fd does a great job of finding lost files on your Linux filesystem, it's better if you don't lose track of them in the first place.

Give your home directory a spring clean by deleting any unnecessary files and folders. But take care not to erase anything actually important!