Skip to content

Lesson 8 of 9 · 18m

fzf, History Search, and the Tools That Compound

Fuzzy finding, reverse history search, and the small tools that make the terminal feel like autocomplete for your brain.

The biggest terminal productivity unlock isn't a new tool — it's searching what you already have. Ctrl-r, fzf, and a few environment tools turn the terminal from "type and hope" to "search and pick."

# Press Ctrl-r, start typing — searches your history backwards
(reverse-i-search)`docker': docker compose up -d

The killer feature: it finds the last matching command — the git commit from yesterday, the ssh from last week, the make deploy you forgot the flags for.

fzf: fuzzy everything

# install fzf, then:
ctrl-t              # fuzzy-find files in the terminal
ctrl-r              # fuzzy history search (replaces default ctrl-r)
alt-c               # fuzzy cd into a directory
vim $(fzf)          # open a file by fuzzy name
kill $(ps aux | fzf | awk '{print $2}')   # pick a process

fzf composes with everything — pipe any list in, get a filtered selection out. ls | fzf, git log --oneline | fzf, docker ps | fzf — the pattern is universal.

The essential one-liners

history | grep ssh        # find past ssh commands
fc -l -50                 # last 50 commands
!!                        # repeat last command
sudo !!                   # repeat last command with sudo
!git                      # repeat last git command
cd -                      # back to previous directory

Field notes

  • zoxide/autojump — z proj jumps to the directory you cd into most often that matches proj; it learns.
  • direnv — auto-load .env files when you cd into a directory; project-specific env vars without polluting the global shell.
  • tldr — community cheatsheets for commands (tldr tar gives you the flags you actually need).