Use fzf to Supercharge Your Command Line Workflow

Use fzf to Supercharge Your Command Line Workflow

Jin LarsenBy Jin Larsen
Quick TipTools & WorkflowsCLIProductivityTerminalDeveloper ToolsWorkflow

Quick Tip

Bind Ctrl+R to fzf for instant fuzzy searching through your entire command history—no more scrolling.

Mastering the command line means spending less time typing paths and more time writing code. fzf — a general-purpose fuzzy finder — turns tedious file navigation into a lightning-fast keyboard-driven experience. Here's how to integrate it into a daily workflow and reclaim hours each month.

What is fzf and how does it work?

fzf reads a list of items from standard input, presents an interactive filter interface, and outputs the selected item. Think of it as "fuzzy search for everything." Type partial strings, it ranks matches by relevance, and hitting Enter pipes the result wherever needed.

The real magic comes from shell integration. Once installed, fzf binds to familiar shortcuts:

  • Ctrl+T — paste selected files into the command line
  • Ctrl+R — search command history (say goodbye to scrolling)
  • Alt+C — cd into selected directories instantly

Worth noting: fzf doesn't just match filenames. It handles branches in Git, running processes, environment variables — basically any line-delimited list.

How do I install fzf on Linux, macOS, or Windows?

Installation takes under a minute on most systems.

For macOS users, Homebrew handles everything:

brew install fzf && $(brew --prefix)/opt/fzf/install

Linux users can grab the latest binary from GitHub or use their package manager. Debian/Ubuntu: sudo apt install fzf. Arch: sudo pacman -S fzf.

Windows folks aren't left out — it runs natively in Windows Terminal via Chocolatey (choco install fzf) or through WSL2.

Which fuzzy finder should you choose in 2024?

fzf dominates the terrain — but alternatives exist. Here's how the major players stack up:

Tool Speed Preview Support Best For
fzf Blazing fast Yes (bat integration) General command line
skim Fast Yes Rust enthusiasts, smaller binaries
peco Good Limited Simple interactive filtering
fzy Very fast No Minimal dependencies

The catch? fzf's ecosystem dwarfs the competition. Thousands of shell scripts, Vim plugins, and community examples assume you're using it.

Pro tips for maximum speed

Enable previews for files — seeing file contents before opening saves countless mis-clicks. Add this to .bashrc or .zshrc:

export FZF_CTRL_T_OPTS="--preview 'bat --color=always --line-range :500 {}'"

Combine fzf with fd (a faster alternative to find) for respecting .gitignore automatically. Set FZF_DEFAULT_COMMAND to use fd, and suddenly fzf ignores node_modules without configuration.

That said, don't over-engineer. Start with the default keybindings. Once muscle memory kicks in — usually within a day or two — layer in customization. The goal isn't a perfect setup; it's typing less and shipping more.