Skip to main content

Module 1: File & Directory Management

Lesson 19: fd Command

In this lesson, you'll learn how to use the fd command as a simple, fast, and user-friendly alternative to the find command in Linux.

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

fd Features

Some of the notable features of fd:

  • Easy to use syntax - fd pattern instead of find -iname pattern.
  • Colorful output similar to the ls command.
  • Fast performance - benchmarks are available on the developer's repository.
  • Smart search - case-insensitive by default and switches to case-sensitive if the pattern contains an uppercase symbol.
  • Does not look in hidden files and directories by default.
  • Does not look into .gitignore by default.
  • Unicode awareness.

Install fd on Linux

Let's look at how to install fd on different Linux distributions using the default package manager, as shown.

$ sudo apt install fd-find          # Debian, Ubuntu and Mint
$ sudo yum install fd-find          # RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux
$ sudo emerge -a sys-apps/fd        # Gentoo Linux
$ sudo pacman -S fd                 # Arch Linux
$ sudo zypper install fd            # OpenSUSE
$ sudo apk add fd                   # Alpine Linux

fd Command Syntax

fd [OPTIONS] [PATTERN] [DIRECTORY]

fd Command Options

Option Description
-e EXT Filter results by file extension
-E PATTERN Exclude files or directories matching a pattern
-x or --exec Execute a command for each search result in parallel
-H Include hidden files and directories in results
-i Case-insensitive search
-s Case-sensitive search
-t TYPE Filter by type: f (file), d (directory), l (symlink)
-h or --help Display help information

1. Check Available Options

Similar to the find command, fd has many use cases, but let's start by checking the available options:

# fd -h

Or:

# fd --help
USAGE:
    fd [FLAGS/OPTIONS] [<pattern>] [<path>...]

FLAGS:
    -H, --hidden            Search hidden files and directories
    -I, --no-ignore         Do not respect .(git|fd)ignore files
    -s, --case-sensitive    Case-sensitive search (default: smart case)
    -i, --ignore-case       Case-insensitive search
    -e, --extension <ext>   Filter by file extension
    -E, --exclude <pattern> Exclude entries matching the given glob pattern

2. List All Files and Directories

Pro TecMint Β· Root Plan
This Article is for Root Members
Join Root to read the full article and unlock everything

Full Access to Every Article, Course & Certification Track

Join thousands of Linux professionals who use Pro TecMint to advance their careers.

Ad-free access to all premium articles
All courses: Learn Linux, Bash, Golang, Ubuntu and more
RHCSA, RHCE, LFCS & LFCA certification prep
New courses added every month
Private Telegram community & priority support
Root Plan
$8/mo
or $59/year billed annually
Save $37 with annual plan
Start Reading This Article in the Next 60 Seconds
Join Root Plan β†’