Finding files like a pro

Free preview 2 min to read

The library registry vs. the digital assistant

Imagine you are in a massive library with millions of books. To find one, you could walk through every aisle (traditional find), or you could ask a modern digital assistant that knows where every book is and even ignores the "Staff Only" sections (modern fd).

The traditional way: find

The find command is the classic Unix tool. It is powerful but has a complex and sometimes confusing syntax.

# Find a file named 'user.rb' starting from the current folder
find . -name "user.rb"

The modern way: fd

Many developers now prefer fd. It is written in Rust, is much faster, and has simpler commands. By default, it ignores hidden folders and everything in your .gitignore (the "Staff Only" sections).

# Find 'user.rb' using fd
fd user.rb

On Debian and Ubuntu the package installs the command as fdfind.

The ultimate speed: fuzzy finding with fzf

What if you only remember part of a filename? fzf (Fuzzy Finder) lets you search interactively. As you type, the list shrinks to match what you are looking for.

# Open an interactive fuzzy search for all files
fzf

Summary table

Tool Best For... Analogy
find Traditional scripts and legacy systems The Library Registry
fd Daily developer use (fast, ignores garbage) The Digital Assistant
fzf Interactive search when you're not sure of the name The Telepathic Filter

Tip: If you are working on a Rails project, fd is your best friend because it skips your log/ and tmp/ folders: Rails' .gitignore lists them.

Lesson 1 of 7 · free

Keep going with lesson 2

Deep inspection

Inspects files with ls -lah and eza, identifies their real type with file, and reads metadata with stat.

A free account also gives you the quizzes, your progress and notes, and the discussion.

Type to start searching...