TiloBox
Back to directory
fzf project preview

fzf

A general-purpose command-line fuzzy finder for interactively filtering lines from files, history, processes, and commands.

LicenseMIT
GitHub stars82.6k
Last commit1 weeks ago
Tags5 topics
CliShellFuzzy SearchOpen SourceTerminal Ui
Overview

Why consider fzf?

fzf is a general-purpose, interactive command-line fuzzy finder written in Go. It reads a list from STDIN, lets you filter it with fuzzy matching in real time, and writes the selection to STDOUT — making it composable with any Unix pipeline. It ships as a single portable binary and includes built-in shell integrations for Bash, Zsh, Fish, and Nushell, plus Vim/Neovim plugins.

Guided learning

Learn fzf by building

Practical setup notes, real use cases, and copy-ready examples in one focused guide.

5 min read 13 sections
In this guide13 sections

fzf — Command-Line Fuzzy Finder

fzf is a general-purpose command-line fuzzy finder and an interactive terminal toolkit. It reads a list of items from standard input, lets you filter them interactively with fuzzy matching, and writes the selected item to standard output. You can think of it as an interactive version of grep that slots into any Unix pipeline.

Source: github.com/junegunn/fzf


Key Highlights

The README lists four headline features:

  • Portable — distributed as a single binary for easy installation
  • Fast — optimized to process millions of items in milliseconds
  • Programmable — event-driven architecture for building custom terminal interfaces and workflows
  • Batteries-included — comes with integrations for Bash, Zsh, Fish, Nushell, Vim, and Neovim

fzf is written in Go, which gives it a single self-contained binary with no runtime dependencies.


Installation

macOS / Linux via Homebrew

sh
1brew install fzf

Linux package managers

fzf is available in virtually every major Linux package manager:

Package ManagerDistributionCommand
APTDebian 9+ / Ubuntu 19.10+sudo apt install fzf
DNFFedorasudo dnf install fzf
PacmanArch Linuxsudo pacman -S fzf
NixNixOSnix-env -iA nixpkgs.fzf

Windows

On Windows, fzf is available via Chocolatey, Scoop, and Winget:

sh
1# Chocolatey
2choco install fzf
3
4# Scoop
5scoop install fzf
6
7# Winget
8winget install fzf

From source (git)

sh
1git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
2~/.fzf/install

The install script adds lines to your shell configuration file to update $PATH and set up shell integration.


Shell Integration

After installing, set up key bindings and fuzzy completion by adding one line to your shell config:

Bash (~/.bashrc):

sh
1# Set up fzf key bindings and fuzzy completion
2eval "$(fzf --bash)"

Zsh (~/.zshrc):

sh
1# Set up fzf key bindings and fuzzy completion
2source <(fzf --zsh)

Fish (~/.config/fish/config.fish):

fish
1# Set up fzf key bindings
2fzf --fish | source

Once set up, three powerful shortcuts become available in your shell:

  • CTRL-T — fuzzy-search files and paste the selection into the command line
  • CTRL-R — fuzzy-search command history
  • ALT-C — fuzzy-search directories and cd into the selected one

Basic Usage

fzf follows Unix philosophy: it is a filter. It reads from STDIN and writes to STDOUT.

sh
1# Open fzf over all files; write the selection to 'selected'
2find * -type f | fzf > selected
3
4# Open a file in vim, chosen via fzf
5vim $(fzf)
6
7# Open fzf in a 40% tall window below the cursor
8fzf --height 40%
9
10# Reverse layout with a border
11fzf --height 40% --layout reverse --border

Without a STDIN pipe, fzf automatically traverses the current directory to build the file list.


Advanced: Pipelines and Dynamic Reloading

fzf's real power shows in pipeline compositions. Here is the canonical process-killer example from the ADVANCED.md docs:

sh
1# 1. ps: Feed the list of processes to fzf
2# 2. fzf: Interactively select a process using fuzzy matching algorithm
3# 3. awk: Take the PID from the selected line
4# 3. kill: Kill the process with the PID
5ps -ef | fzf | awk '{print $2}' | xargs kill -9

The --bind and reload actions let you dynamically update the candidate list without restarting fzf:

sh
1(date; ps -ef) |
2 fzf --bind='ctrl-r:reload(date; ps -ef)' \
3 --header=$'Press CTRL-R to reload\n\n' --header-lines=2 \
4 --preview='echo {}' --preview-window=down,3,wrap \
5 --layout=reverse --height=80% | awk '{print $2}' | xargs kill -9

You can also switch between multiple data sources with separate key bindings:

sh
1find * | fzf --prompt 'All> ' \
2 --header 'CTRL-D: Directories / CTRL-F: Files' \
3 --bind 'ctrl-d:change-prompt(Directories> )+reload(find * -type d)' \
4 --bind 'ctrl-f:change-prompt(Files> )+reload(find * -type f)'

Preview Window

fzf supports a built-in preview window that runs an arbitrary command on the highlighted item:

sh
1# Preview file contents with bat
2fzf --preview 'bat --color=always {}'
3
4# Preview with syntax highlighting, border and 60% height
5fzf --preview 'bat --color=always {}' --preview-window '~3'

Vim / Neovim Integration

For Vim users with vim-plug:

vim
1Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
2Plug 'junegunn/fzf.vim'
  • junegunn/fzf provides the core library and keeps the binary up-to-date via fzf#install().
  • junegunn/fzf.vim is a separate project that wraps fzf into convenient Vim commands like :Files, :Buffers, :Commits, and more.

Neovim users who prefer Lua-based plugins can use the community-maintained fzf-lua plugin.


Customizing Defaults

All options can be set permanently via the $FZF_DEFAULT_OPTS environment variable:

sh
1export FZF_DEFAULT_OPTS="--height=40% --layout=reverse --info=inline --border --margin=1 --padding=1"

Override the default file source with $FZF_DEFAULT_COMMAND:

sh
1# Use fd (respects .gitignore) as the default file source
2export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'

License

fzf is released under the MIT License.

Related tools

More options with a similar category or technology profile.

fzf FAQs

fzf is listed as a Developer Tools tool on TiloBox. Review the overview, features, and official documentation on this page to decide whether it solves your specific workflow.

Start with the project's GitHub repository and official website for supported installation and deployment instructions. Test the setup with representative data or a small project before rolling it out more widely.

fzf is listed under the MIT license. Read the complete license text and the project's notices before using, modifying, or distributing the software.

Production readiness depends on your requirements. Review maintenance activity, security practices, documentation, backup and upgrade procedures, and compatibility with your stack; then validate it in a non-production environment.

fzf is listed as an alternative to ripgrep. Compare the core workflow, deployment model, integrations, and licensing against your must-have requirements before switching.