If you’re looking for a practical fzf tutorial for Linux, you’ve landed in the right place. fzf – short for “fuzzy finder” – is one of those tools that quietly rewires how you work in the terminal. Install it, spend an afternoon playing with it, and by the next day you’ll be wondering how you lived without it.
This fzf tutorial covers 10 concrete, real-world use cases. No fluff, no theory – just commands you can run right now.
Here’s what we’ll cover in this fzf tutorial:
- What fzf is and why it matters
- Installing it on any Linux distro
- Using it to find and open files instantly
- Supercharging your shell history search
- Killing processes, SSH’ing into servers, and more
What Is fzf? A Quick Overview for This fzf Tutorial
fzf is a general-purpose fuzzy finder for the command line. Give it a list of anything – files, processes, Docker containers, bookmarks – and it gives you an interactive search box. Type a few characters, and the list narrows down in real time.
The “fuzzy” part means you don’t need to type things in order. Searching for cronback will match crontab_backup.sh because the characters c-r-o-n-b-a-c-k appear in sequence, even with gaps. It feels like the tool reads your mind.
Installing fzf: Getting Started With This fzf Tutorial
On Debian or Ubuntu:
sudo apt update
sudo apt install fzf
On Arch:
sudo pacman -S fzf
Want the absolute latest version? Clone straight from the official fzf GitHub repository:
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
The install script asks whether to hook fzf into Bash or Zsh – say yes to everything. This sets up key bindings and a completion system we’ll get to in a moment.
1. Finding Files: The Core of Any fzf Tutorial
At its simplest, fzf reads lines from stdin, shows them interactively, and prints your selection back to stdout:
find . -type f | fzf
A full-screen search box appears. Type part of a filename, and fzf filters instantly. Arrow keys navigate. Enter picks the file. Ctrl-C cancels.
The magic is what you do with the selection. Here’s a shell function that opens whatever file you pick in vim, with a live preview:
function fv() {
local file
file=$(find . -type f | fzf --preview 'head -100 {}')
if [[ -n "$file" ]]; then
vim "$file"
fi
}
Drop that in your .bashrc or .zshrc, reload, and type fv. The --preview flag is fzf’s secret weapon – it shows the first 100 lines of whatever file is highlighted. You can preview images with chafa or peek into directories with tree.
If you’re already familiar with modern Linux command-line tools like eza, fzf pairs beautifully with them for an even faster workflow.
2. Supercharging Command History Search
When you install fzf with shell hooks (say yes during installation), Ctrl-R gets a serious upgrade. Instead of Bash’s clunky reverse-i-search, you get a full fzf overlay over your entire command history.
Type part of a command you ran three days ago – docker compose restart – and fzf digs it up instantly. Hit Enter to paste it, or Ctrl-R again to run it.
This alone saves dozens of keystrokes every day.
3. Killing Processes With Fuzzy Search
Need to kill a process but can’t remember the PID? With fzf completions loaded, type kill -9 and hit Tab. fzf presents a fuzzy-searchable list of every running process.
Type nginx, pick the right one, and the PID fills in automatically. Same trick works with killall and even systemctl – try systemctl stop + Tab to fuzzy-search systemd units.
4. Fuzzy SSH: No More Config Scrolling
If you manage more than a handful of servers, you’ve wasted time scrolling through ~/.ssh/config. Type ssh and hit Tab – fzf reads your SSH config and presents a fuzzy-searchable list of every host. No more squinting at text files trying to remember if it was web-prod-03 or web-prod-4.
5. cd With FZF: Never Type a Path Again
Install fzf with the --preview flag on directories, and you get a visual directory browser. But the real game-changer is combining fzf with fd – a faster, more intuitive find alternative (check out fd on GitHub):
alias fcd='cd $(find . -type d | fzf)'
Type fcd, start typing the folder you want, and jump there instantly. If you liked our guide on eza (the modern ls replacement), you'll love this combo.
6. Browsing Inside Archives Without Extraction
Here's a neat trick. Combine fzf with tar to explore tarballs without extracting anything:
tar tzf archive.tar.gz | fzf --preview 'tar xzf archive.tar.gz --to-stdout {} 2>/dev/null | head -80'
As you highlight each file inside the archive, the preview pane shows its contents. Config files, source code, documentation - all browsable without leaving a mess on your disk.
7. Interactive Kill With Kill -TERM
You can combine fzf with kill for a visual process killer. Instead of guessing PIDs, pipe ps aux into fzf and pass the selection to kill:
ps aux | fzf | awk '{print $2}' | xargs kill -15
Navigate with arrow keys, see every process's CPU and memory usage in the preview, and terminate with confidence.
8. Turning fzf Into a Custom Menu
Any collection of commands becomes an interactive menu. Say you have a ~/scripts directory:
./$(ls ~/scripts/*.sh | fzf --preview 'head -30 {}')
fzf lists all scripts with a preview of what each one does. Pick one, and it runs. I use this for database connections - each line in a file is a psql connection string for a different environment:
psql "$(cat ~/.db_connections | fzf)"
Pick prod, staging, or dev from a fuzzy list, and you're connected.
9. Docker Container Management With fzf
If you work with Docker daily, fzf makes container management painless:
docker rm $(docker ps -a | fzf | awk '{print $1}')
The same pattern works for Docker images, volumes, and network inspection. Combine fzf with docker logs to tail logs from the container you pick interactively.
For deeper server management, check out our complete Wazuh server setup guide - another essential tool for anyone running infrastructure.
10. Advanced: Key Bindings and Custom Actions
The --bind flag lets you attach custom actions to key presses inside fzf:
find . -type f | fzf --bind 'ctrl-e:execute(vim {})'
Press Ctrl-E on any file, and vim opens it immediately. You can also use --bind 'ctrl-r:reload(find . -type f)' to re-scan without restarting fzf.
Spend 15 minutes with man fzf - the preview window options alone (--preview-window) are worth the read. You can position the preview on any side, wrap long lines, or toggle it on and off.
Where To Go From Here
If this fzf tutorial clicked with you, the natural next step is combining fzf with bat (syntax-highlighted previews), fd (a faster find), and ripgrep (content search piped into fzf). That trio turns your terminal into something closer to an IDE than a shell.
Start simple - just the file picker and Ctrl-R. Use them for one day. I promise you won't go back.