fzf Basics: Search, Select, and Script Output

Core fzf usage patterns for filtering lists, selecting items, and integrating the result into shell workflows.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Core usage

Use fzf as a standalone fuzzy selector in shell pipelines.

Select files from a pipeline

Pipe any list into fzf and interactively pick a line.

bashANYpipelinefilesstdin
bash
find . -type f | fzf
Notes

fzf reads from standard input, so any command that prints lines can become an interactive picker.

Open the selected file in an editor

Capture the selected value and open it with $EDITOR.

bashANYeditorselectionfiles
bash
vim "$(find . -type f | fzf)"
Notes

Classic pattern for launching your editor on a fuzzy-selected file.

Enable multi-select

Pick multiple lines instead of a single match.

bashANYmulti-selectselection
bash
find . -type f | fzf -m
Notes

Use TAB to mark multiple items and Enter to accept them.

Use exact matching

Turn off fuzzy matching and only match the query literally.

bashANYexactmatching
bash
ps -ef | fzf --exact
Notes

Helpful when the result set is noisy and you want strict matching.

Match on specific fields

Restrict matching to selected delimited fields.

bashANYfieldsnthmatching
bash
ps -ef | fzf --nth=1,8..
Notes

Useful for ignoring noisy columns while keeping them visible in the UI.

Transform what is displayed

Hide or reorder fields in the list without changing the selected line.

bashANYdisplaywith-nthprocesses
bash
ps -ef | fzf --nth=1,8.. --with-nth=8..
Notes

Common for process pickers and tabular output.

Set a custom field delimiter

Parse colon- or tab-delimited input cleanly.

bashANYdelimiterstructured-data
bash
cut -d: -f1,3 /etc/passwd | fzf --delimiter=':' --with-nth=1
Notes

Pair this with --nth or --with-nth for structured line formats.

Query and output control

Seed the query, print clean output, and control exit behavior.

Start with a prefilled query

Open fzf with an initial search string.

bashANYquerystartup
bash
git branch --all | fzf --query='feature/'
Notes

Good for narrowing large lists from the first render.

Auto-accept single matches

Accept immediately when there is exactly one match.

bashANYselect-1exit-0automation
bash
find . -type f | fzf --select-1 --exit-0
Notes

Popular in scripts because it reduces extra keystrokes on precise searches.

Run in non-interactive filter mode

Use fzf as a fuzzy filter without opening the UI.

bashANYfilternon-interactivescripts
bash
printf '%s
' alpha beta gamma | fzf --filter=gm
Notes

Great for scripts when you want fzf matching semantics without TUI interaction.

Recommended next

No recommendations yet.