$linuxjunkies
>

fzf(1)

A general-purpose command-line fuzzy finder that filters input interactively with a search interface.

UbuntuDebianFedoraArch

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

FlagWhat it does
-m / --multiAllow multiple selections; use Tab to toggle items
-x / --extendedExtended search mode; use spaces to match multiple patterns
-e / --exactExact match mode (no fuzzy matching); anchors and literal strings only
--preview CMDDisplay preview window showing CMD output for the selected item
-q / --query STRStart with this search query pre-filled
--height NUMSet height of fzf window (e.g., 50% or 20)
--reverseReverse list order (display bottom-up)
-1 / --select-1Automatically select if only one match remains
-0 / --exit-0Exit with code 0 even if no item selected
--bind KEYSCustom keybindings, e.g. --bind 'alt-a:select-all'
-d / --delimiter SEPUse SEP as field delimiter for field selection with Ctrl-Space
--no-sortDisable sorting of matches; preserve input order

Examples

List files and folders in current directory, select one interactively

ls | fzf

Search and select a word from the system dictionary

fzf < /usr/share/dict/words

Search 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 cat

Choose 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

Related commands