fzf(1)
A general-purpose command-line fuzzy finder that filters input interactively with a search interface.
Synopsis
fzf [OPTION]... [FILE]...Description
fzf is a fuzzy finder that reads a stream of input, displays it in an interactive searchable window, and outputs the selected line(s) to stdout. It excels at searching files, command history, process lists, and any line-based data with partial matching and scoring.
Common usage includes piping command output to fzf, using shell keybindings for history/file search, and integration with editors and scripts. It works in stdin/stdout mode by default, making it composable with any Unix tool.
Common options
| Flag | What it does |
|---|---|
-m / --multi | Allow multiple selections; use Tab to toggle items |
-x / --extended | Extended search mode; use spaces to match multiple patterns |
-e / --exact | Exact match mode (no fuzzy matching); anchors and literal strings only |
--preview CMD | Display preview window showing CMD output for the selected item |
-q / --query STR | Start with this search query pre-filled |
--height NUM | Set height of fzf window (e.g., 50% or 20) |
--reverse | Reverse list order (display bottom-up) |
-1 / --select-1 | Automatically select if only one match remains |
-0 / --exit-0 | Exit with code 0 even if no item selected |
--bind KEYS | Custom keybindings, e.g. --bind 'alt-a:select-all' |
-d / --delimiter SEP | Use SEP as field delimiter for field selection with Ctrl-Space |
--no-sort | Disable sorting of matches; preserve input order |
Examples
List files and folders in current directory, select one interactively
ls | fzfSearch and select a word from the system dictionary
fzf < /usr/share/dict/wordsSearch bash history and re-run selected command
history | fzf --preview 'echo {}' | xargs -I {} sh -c '{}'Select one or more commits from git log, output their hashes
git log --oneline | fzf --multi | awk '{print $1}'Show file list with a preview pane on the right showing file contents
fzf --preview 'cat {}' --preview-window right:50%Find files, select multiple with Ctrl-A, concatenate all selected files
find . -type f | fzf -m --bind 'ctrl-a:select-all' | xargs catChoose a running process (skip header), output its PID
ps aux | fzf --reverse --header-lines 1 | awk '{print $2}'Search with 'main' pre-filled; auto-select if unique, exit cleanly if none found
fzf --query 'main' --select-1 --exit-0 < /dev/null