Back to terminal directory

CLI tools · Productivity

fzf

Fuzzy finder that upgrades shell history, file search, and git workflows.

Open sourceGo
Official site
Short answer

fzf is a fast, open-source fuzzy finder for the command line, written in Go by Junegunn Choi and released under the MIT license. It reads a list of lines, such as file names, command history or git branches, and lets you filter it by typing a few letters in any order. Its shell integration adds three key bindings: CTRL-T to insert files, CTRL-R to search command history and ALT-C to change directory. Install it with your package manager, such as brew install fzf, then add one line to your shell config, for example eval "$(fzf --bash)" for bash.

License
MIT
GitHub, junegunn/fzf
Written in
Go
GitHub, junegunn/fzf
Latest release
0.74.5, October 11, 2026
fzf changelog
Shells with built-in integration
bash, zsh, fish (Nushell from 0.73)
fzf README

Updated October 21, 2026How we evaluate tools

fzf guide: install, shell key bindings, previews and everyday recipes

fzf is one of the most installed command-line tools of the last decade. Junegunn Choi started it in 2013, it is written in Go, ships as a single binary and is released under the MIT license. It is actively maintained: version 0.74.5 shipped on October 11, 2026, and the 0.73 series added Nushell integration.

Its idea is small. fzf reads lines, lets you filter them by typing, and prints what you choose. That makes it a building block. You can put it in front of almost any command that produces a list, and many other tools, including vim and neovim plugins, git helpers and AI agents, use it for their pickers.

Installing fzf

SystemCommand
macOSbrew install fzf
Debian, Ubuntusudo apt install fzf
Fedorasudo dnf install fzf
Archsudo pacman -S fzf
Windowswinget install fzf or scoop install fzf
From sourcegit clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install

Some Linux distributions ship old versions. The shell integration commands below need 0.48 or later, so check with fzf --version.

Turning on shell integration

The shell integration is where most people get value from fzf. Add one line to your shell config:

ShellAdd to config
bash (~/.bashrc)eval "$(fzf --bash)"
zsh (~/.zshrc)source <(fzf --zsh)
fish (~/.config/fish/config.fish)fzf --fish | source

Open a new terminal and you get:

KeyWhat it does
CTRL-RSearch command history and put the chosen command on the prompt
CTRL-TPick one or more files and insert their paths at the cursor
ALT-CPick a folder and cd into it
** then TabFuzzy completion for paths, hosts, processes and more (bash and zsh)

For example, vim **<Tab> opens a file picker and kill -9 **<Tab> opens a process picker. ssh **<Tab> lists hosts from your SSH config and known hosts.

How fuzzy matching works

You type characters, and fzf keeps lines that contain them in order, not necessarily next to each other. cfgprd matches config/production.yml. fzf ranks results so tighter matches, matches at word boundaries and shorter lines come first.

You can also use search syntax for precision:

PatternMeaning
'exactExact substring match
^srcLine starts with "src"
.ts$Line ends with ".ts"
!testExclude lines containing "test"
foo | barMatch foo or bar

Space separates terms, and every term must match.

Previews

The --preview option runs a command for the highlighted line and shows its output beside the list:

fzf --preview 'bat --color=always --line-range :200 {}'

To get previews in CTRL-T, set an environment variable in your shell config:

export FZF_CTRL_T_OPTS="--preview 'bat --color=always --line-range :200 {}'"

FZF_CTRL_R_OPTS and FZF_ALT_C_OPTS work the same way for the other bindings. A common ALT-C preview is a directory tree, using tree -C {} or eza --tree {}.

To change which files CTRL-T lists, set FZF_CTRL_T_COMMAND. Many people use fd here because it respects .gitignore and is fast: export FZF_CTRL_T_COMMAND="fd --type f --hidden --exclude .git".

Everyday recipes

Check out a git branch:

git branch --all | fzf | sed 's/remotes\/origin\///' | xargs git switch

Open a file changed in the working tree:

git diff --name-only | fzf --preview 'git diff --color=always -- {}' | xargs -o vim

Pick a commit to inspect:

git log --oneline | fzf --preview 'git show --color=always {1}' | cut -d' ' -f1

Kill a process:

ps -ef | fzf --header-lines=1 | awk '{print $2}' | xargs kill

Search inside files with ripgrep: fzf's README includes a pattern that reruns rg as you type, using the --bind 'change:reload:...' option, so fzf becomes an interactive grep with previews.

Changing the layout and colors

Set defaults for every fzf call with FZF_DEFAULT_OPTS:

export FZF_DEFAULT_OPTS="--height 40% --layout reverse --border --info inline"

--height opens fzf below the cursor instead of full screen, which keeps your scrollback visible. --layout reverse puts the prompt at the top. --border and --info adjust the frame and the match counter. Color schemes go in the same variable with --color, and the fzf wiki has ready-made themes that match popular terminal palettes.

FZF_DEFAULT_COMMAND sets what fzf lists when you run it with no input. Pointing it at fd or rg --files makes plain fzf skip ignored files and run faster in large repositories.

Using fzf in your own scripts

Scripts use a few options most:

  • -m allows multiple selections. Tab marks a line, and fzf prints every marked line.
  • --query starts with text already typed.
  • --select-1 and --exit-0 skip the picker when there is one match or none.
  • --expect=ctrl-v,ctrl-x reports which key the user pressed, so one picker can open a file in different ways.
  • --bind attaches actions to keys, such as --bind 'ctrl-y:execute-silent(echo {} | pbcopy)' to copy the current line.

fzf exits with status 0 when you pick something, 1 when nothing matched and 130 when you cancel, so scripts can tell the cases apart.

fzf with tmux

With --tmux (or the older --popup style), fzf opens in a tmux popup window instead of taking over the pane. That keeps your current output visible. If you use tmux to run AI agents in one pane and tests in another, a popup picker lets you jump between sessions or files without disturbing either.

fzf with AI agents

Agents generate lists you need to choose from. A few ways fzf helps:

  • After an agent run, pick which changed file to review from git diff --name-only.
  • Choose which files to add to an Aider chat: aider $(git ls-files | fzf -m). The -m flag allows multiple selections with Tab.
  • Pick a past session to resume from a list of session files.
  • Search your command history for the exact command an agent ran yesterday.

Limits

It only filters text. fzf has no knowledge of what the lines mean. The command you feed it decides what is useful.

Key bindings can clash. ALT-C does not work in some macOS terminals until you set Option to act as Meta. CTRL-T may conflict with other tools' bindings. You can rebind any of them.

Old distribution packages. If fzf --bash fails, your version is too old. Install a newer one.

fzf compared with similar tools

ToolWhat it isBest for
fzfGeneral-purpose fuzzy finderPickers for anything, shell history, scripts
skim (sk)Rust fuzzy finder inspired by fzfPeople who want an fzf-like tool in Rust
AtuinShell history database with syncSearching and syncing history across machines
zoxideSmarter cd that learns your foldersJumping to frequent folders by name

Many people run fzf and zoxide together, with Atuin or fzf for history. For a better shell to run them in, see fish, and for the full set of tools, the terminal tools guide.

Frequently asked questions

What does fzf do?

fzf takes any list of lines on standard input, shows it in an interactive filter, and prints the line or lines you pick. Typing narrows the list with fuzzy matching, so 'srcmain' finds src/app/main.ts. Because it works on plain text, you can feed it files, processes, git commits, Docker containers or anything else, and pipe the selection into another command.

How do I install fzf?

Use your package manager: brew install fzf on macOS, apt install fzf on Debian and Ubuntu, dnf install fzf on Fedora, pacman -S fzf on Arch, or winget install fzf or scoop install fzf on Windows. Distribution packages can lag behind, so for the newest version use Homebrew, the GitHub release binaries or the git install script in the README.

How do I turn on the CTRL-R and CTRL-T key bindings?

Add one line to your shell config. For bash, add eval "$(fzf --bash)" to ~/.bashrc. For zsh, add source <(fzf --zsh) to ~/.zshrc. For fish, add fzf --fish | source to ~/.config/fish/config.fish. This needs fzf 0.48 or later. Open a new shell and press CTRL-R to search history, CTRL-T to pick files and ALT-C to jump to a folder.

How do I show file previews in fzf?

Use the --preview option with a command that prints the file, for example fzf --preview 'bat --color=always {}'. The {} placeholder is replaced with the highlighted line. To apply this to CTRL-T, set FZF_CTRL_T_OPTS in your shell config with the same preview option. bat adds syntax highlighting, and cat works if you do not have bat installed.

Why is fzf useful with AI coding agents?

Agents produce long lists: changed files, sessions, logs and branches. fzf lets you pick from those lists quickly, for example choosing which changed file to open after an agent run, picking a past agent session to resume, or selecting files to add to an Aider chat. Several agents and plugins use fzf for their own pickers.

Sources

  1. fzf on GitHub
  2. fzf changelog
  3. fzf README, shell integration
  4. fzf wiki, examples
  5. bat