The User-friendly Alternative to Find

The User-friendly Alternative to Find

`fd` is a super fast, Rust-based alternative to the UNIX/Linux `find` command. It does not mirror all of `find's` powerful functionality, however it does provide just enough features to cover 80% of the use cases you might run into. Features like a well thought out and convenient syntax, colorized output, smart case, regular expressions, and parallel command execution make `fd` a more than capable successor.

Tutorial

First off, to get a complete overview of all available command-line options, you can either run `fd -h` for concise help or `fd --help` for more detailed help.

Simple Search

`fd` is designed to help you easily find files and folders in your operating system's filesystem. The simplest search that you can perform is to run `fd` with a single argument, that argument being whatever it is that you're searching for. For example, let's assume that you want to find a Markdown document that has the word `services` as part of the filename:

$ fd services

If called with just a single argument, `fd` searches the current directory recursively for any files and/or directories that match your argument. The equivalent search using the built-in `Find` command looks something like this:

$ find . -name 'services'

As you can see `fd` is much simpler and requires you to type less. Getting more done with less typing is always a win in my book.

Files and Folders

You can restrict your search to files or directories by using the `-t` argument followed by the letter which represents what you want to search for. For example, to find all files in the current directory that have `services` in the filename you would use:

$ fd -tf services

And, to find all directories in the current directory that have `services` in the filename.

$ fd -td services

How about listing all documents with the `.md` extension in the current folder?

$ fd .md

administration/administration.md

development/elixir/elixir_install.md

As you can see from the output `fd` not only found and listed files from the current folder but it found files in sub-folders. Pretty neat. You can even search for hidden files using the `-H` argument.

fd -H sessions .

Specifying a directory

If we want to search a specific directory, the name of the directory can be given as a second argument to `fd`:

$ fd passwd /etc

In this example we're telling `fd` that we want to search for all instances of the word `passwd` in the `etc` directory.

Global Searches

What if you know part of the filename but not the folder? Let's say we downloaded a book on Linux Network Administration but we have no idea where it was saved. No problem.

$ fd Administration /

Wrapping Up

The `fd` utility is an excellent replacement for the `find` command and I'm sure you'll find it just as useful as I do. If interested, you can install it on your system using your local package manager (apt, dnf, brew). To learn more about the command, simply explore the rather extensive Man page.

To view or add a comment, sign in

More articles by Patrick Mullins

  • Building a Full Stack DevOps Pipeline: Part One (Bitbucket)

    In this series of blog posts I will be walking you through the process of building your own DevOps Technology Stack…

  • Speeding up macOS Sierra

    Every year (like clockwork) Apple releases a shiny new version of macOS for everyone to play with. Likewise, every year…

  • Stellar Phoenix Data Recovery for iPhone

    Data Recovery We've all done it at least once. We're in a hurry, flicking through hundreds of photos on our iPhones for…

  • Why PuTTY when you can SSH?

    Over the past few weeks I've seen several threads pop up in various Mac forums about installing PuTTY. These questions…

  • Docker on the Raspberry Pi

    Up until recently installing Docker on the Raspberry Pi was a lengthy process that involved building Docker from source…

  • Installing macOS 10.12 via USB

    When faced with a new version of your operating system you typically have two choices. Upgrade your existing…

  • .NET Projects on Linux and macOS

    In order to build .NET projects on Linux (Debian/Ubuntu/Raspbian) or macOS you first need to download and install the .

  • Firefox Tweaks: Use Memory for Cache

    Think of all the images you see when you view your favorite news, forum, or social media sites. All of those images…

    3 Comments
  • Stellar Phoenix Mac Data Recovery 7.1

    Managing files on our computers is something that most of us do every single day. We download files, copy them, move…

  • Turning OS X 10.11 El Capitan into a Speed Deamon

    OS X Defaults System Buried deep inside the underpinnings of Mac OS X is an extremely powerful command-line program…

    10 Comments

Explore content categories