fzf Recipes: Files, ripgrep, Git, Processes, and Navigation

Practical pipeline recipes that combine fzf with fd, ripgrep, bat, Git, and shell utilities.

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

File and code recipes

Combine fzf with fd, rg, bat, and editors for fast project navigation.

Find project files with fd and fzf

Use fd as the file source for faster recursive listing.

bashANYfdfilesprojects
bash
fd --type f | fzf

A better default than find for many modern developer workflows.

Search with ripgrep then open in Vim

Use ripgrep for content search and fzf for interactive selection.

bashANYrgvimsearch
bash
rg --line-number --no-heading --color=always 'TODO|FIXME' | fzf --ansi | cut -d: -f1 | xargs -r vim

A common pattern for jumping from search results into an editor.

Preview ripgrep matches with context

Combine ANSI results with a syntax-highlighted preview.

bashANYpreviewrgbat
bash
rg --line-number --no-heading --color=always 'auth' | fzf --ansi --delimiter=':' --preview 'bat --color=always --highlight-line {2} {1}'

The delimiter lets preview commands reference filename and line number separately.

Pick and switch branches

Use fzf to choose a Git branch interactively.

bashANYgitbranchesswitch
bash
git branch --all --color=always | sed 's/^..//' | fzf --ansi | xargs -r git switch

Good example of fzf turning a noisy CLI list into a smooth navigation step.

Browse recent commits

Preview commit details while selecting a hash.

bashANYgitcommitspreview
bash
git log --oneline --color=always | fzf --ansi --preview 'git show --color=always {1}'

A lightweight commit browser for the terminal.

Select and kill a process

Pick a process from ps output and send it a signal.

bashANYprocesseskilladmin
bash
ps -ef | sed 1d | fzf --nth=2.. --multi | awk '{print $2}' | xargs -r kill -15

Useful admin shortcut when process names are easier to remember than PIDs.

History and navigation recipes

Speed up shell history, cd workflows, and bookmark-like selectors.

Jump to a recent directory

Use a list of tracked directories as an interactive jump menu.

bashANYdirectoriescdnavigation
bash
printf '%s
' ~/src ~/work ~/notes | fzf | xargs -I{} cd '{}'

In practice you would wrap this in a shell function because cd must run in the current shell.

Browse man pages interactively

Choose a command and open its man page.

bashANYmandocsnavigation
bash
apropos . | fzf | awk '{print $1}' | xargs -r man

Turns discoverability into an interactive workflow.

Recommended next

No recommendations yet.