repobenchmarks // fuzzy finder recipes
CLI PRODUCTIVITY
$ eval "$(fzf --bash)" # or --zsh

fzf Interactive Shell Guide

A comprehensive collection of practical bash and zsh workflows using Junegunn Choi's ubiquitous command-line fuzzy finder.

Ctrl-R: Smart History Ctrl-T: File Finder Alt-C: Instant cd
Key Metrics
GitHub Stars: > 64k
Language: Go (Compiled)
License: MIT

The command line is unmatched for speed, but typing exact file paths, searching through thousands of shell history lines, and locating process IDs often leads to repetitive typing. fzf is an interactive Unix filter that reads any list from standard input, fuzzy searches matches as you type, and prints selected results to standard output.

The Three Essential Default Keybindings

Enabling fzf’s shell integration binds three foundational shortcuts into Bash and Zsh:

  • Ctrl + R (Interactive History Search): Replaces the clumsy readline reverse-i-search with a responsive fuzzy search over your entire shell command history.
  • Ctrl + T (Paste File Path): Launches a fuzzy file search starting from the current directory and pastes the selected file path directly into your active command line.
  • Alt + C (Fuzzy cd): Interactively searches subdirectories and immediately issues a cd command into the chosen directory upon pressing Enter.
fzf Unix Stream Processing Architecture
fzf Interactive Filtering Pipeline Shows standard input streaming into fzf's interactive TUI filter and outputting selected lines to stdout. stdin stream files | git | ps | history fzf Interactive Engine Asynchronous fuzzy scoring Sidecar preview subprocess Keyboard event loop stdout selection Piped to vim, git, kill

High-Value Custom Shell Functions

# 1. Interactive Git Branch Checkout
fco() {
  git branch -a --sort=-committerdate |
    grep -v '/HEAD\s' |
    fzf --height 40% --layout reverse --preview 'git log -n 5 --color=always {1}' |
    sed 's/.* //;s#remotes/[^/]*/##' |
    xargs git checkout
}

# 2. Interactive Process Killer
fkill() {
  local pid
  pid=$(ps -ef | sed 1d | fzf -m --preview 'echo {}' | awk '{print $2}')
  if [ -n "$pid" ]; then
    echo "$pid" | xargs kill -${1:-9}
  fi
}
Recipe Key Shortcut / Trigger Primary Benefit
Reverse Command Search Ctrl + R Fuzzy search full multiline command history
File Path Insertion Ctrl + T Insert relative path with live syntax preview
Fuzzy Directory Change Alt + C Jump to any deep subfolder without typing paths
Kill Process fkill alias Multi-select rogue containers or hung servers
Git Branch Switch fco alias Preview last commits while switching branches
⚠ Performance Optimization: Replace Default find with fd

By default, fzf uses the standard Unix find utility to generate file lists, which traverses .git and node_modules. For massive speedups, set export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git' in your ~/.zshrc or ~/.bashrc.

Conclusion

fzf is one of the most transformative command-line utilities available. Adding its shell integration and custom aliases will instantly streamline your daily terminal navigation, git management, and process debugging.