Tools

fzf: the terminal fuzzy finder for files, history and git branches

TL;DR

fzf turns any list into a fast picker. Enable shell integration for Ctrl+R history search, Ctrl+T file picking and Alt+C directory jumps, then combine it with fd and bat for an IDE-like terminal.

You vaguely remember a file name containing "invoice", or a long command you typed last week, but not exactly. fzf is a fuzzy filter for the terminal: it takes any list (files, command history, git branches, processes), lets you type a few characters to filter instantly, and returns the line you pick. Because it does exactly one thing, picking from a list, you can combine it with almost any other command.

GitHub page of junegunn/fzf
GitHub page of junegunn/fzf (screenshot, November 2026)

GitHub: https://github.com/junegunn/fzf · about 84k stars · Go · MIT

Install and enable shell integration

brew install fzf          # macOS
winget install fzf        # Windows
sudo apt install fzf      # Ubuntu/Debian (the packaged version may be old)

# Add to ~/.zshrc (bash: eval "$(fzf --bash)")
source <(fzf --zsh)

That last line enables the key bindings and completion. For older versions without --zsh, use the install script described in the README.

Three shortcuts for every day

KeyEffectSituation
Ctrl+RSearch command historyType "dock run" to find yesterday's long docker command
Ctrl+TPick files/directories and paste their pathsType vim then Ctrl+T to choose the file
Alt+CPick a subdirectory and cd into itJump into deeply nested folders

There's more: type ** then Tab for fzf-powered completion, e.g. cd **<Tab> or kill -9 **<Tab> to pick a process.

Search syntax

  • conf yml: fuzzy-match both terms, in any order.
  • 'exact: exact match.
  • ^src / .ts$: starts or ends with.
  • !test: exclude lines containing "test".
  • .ts$ | .tsx$: OR condition.

Combining fzf with other commands

# Switch git branches by picking one
git branch --all | fzf | sed 's/remotes\/origin\///' | xargs git switch

# Open a file with a syntax-highlighted preview (needs bat)
fzf --preview 'bat --color=always {}' | xargs -r code

# Use fd as the file source (fast, respects .gitignore)
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"

Inside fzf: Tab selects multiple lines (when run with -m), Ctrl+J/K or the arrows move, Enter confirms, Esc cancels.

Caveats

  • The apt version of fzf may be old and lack --zsh; install from GitHub releases or Homebrew for newer features.
  • On macOS, Alt+C requires setting Option as the Meta key in your terminal settings (iTerm2, Terminal.app).
  • When piping selections into dangerous commands like rm, check your choice before pressing Enter.

How to apply it

  • Dev: Enable shell integration today; Ctrl+R alone saves a lot of retyping. Then write a few small .zshrc functions for repetitive picks (branches, containers).
  • Tech Lead: Use fzf in internal scripts that need a human choice (pick a deploy environment, pick a service to tail) instead of requiring exact names.
  • PM: A tiny tool that removes repetitive work; worth adding to onboarding docs for new developers.

Sources & references

  1. junegunn/fzf — junegunn (GitHub)