← Back to tools
View AGENTS.md for fzf
fzf
A command-line fuzzy finder
Description
fzf is a general-purpose command-line fuzzy finder. It's an interactive filter for any kind of list: files, command history, processes, hostnames, bookmarks, git commits, etc. It's fast, portable, and has a flexible layout.
Install
homebrew
brew install fzfapt
sudo apt install fzfpacman
sudo pacman -S fzfgo
go install github.com/junegunn/fzf@latestAI Summary
Interactive fuzzy-matching filter for the terminal. Pipe any list in, user narrows by typing. Essential for interactive selection from large datasets.
Capabilities
- + Interactive fuzzy search over arbitrary line-based input
- + File finder (replaces find + manual filtering)
- + Preview pane for file contents or command output
- + Multi-select mode for choosing multiple items
- + Shell keybinding integration (Ctrl-R for history, Ctrl-T for files, Alt-C for cd)
- + Customizable layout, colors, and key bindings
Use When
- → User needs to interactively pick one or more items from a large list
- → Building a selector/picker UI in a shell script
- → Enhancing shell history search
- → Creating interactive file navigation workflows
Avoid When
- x Non-interactive / headless environments (CI pipelines)
- x Input is already small enough that a simple grep suffices
- x Need programmatic filtering without user interaction
Usage Patterns
Find and open a file
vim $(fzf) Lists all files, user picks one, opens in vim
Search command history
history | fzf Fuzzy search through shell history
Interactive git branch checkout
git branch | fzf | xargs git checkout Pick a branch interactively, then check it out
Kill a process interactively
ps aux | fzf | awk '{print $2}' | xargs kill Select a process from the list and kill it
Input / Output
stdin: Any line-based text (one item per line)
stdout: The selected line(s)
Exit codes:
0 Item selected 1 No match 2 Error 130 Interrupted (Ctrl-C) Typical Pipelines
fd --type f | fzf --preview 'bat --color=always {}' | xargs vim rg --files-with-matches pattern | fzf --preview 'rg --color=always pattern {}' docker ps | fzf | awk '{print $1}' | xargs docker logs -f