fzf
1. What is fzf?
fzf is a command-line fuzzy finder.
It lets you:
- Search files, directories, command history, git commits, etc.
- Type partial keywords instead of exact matches
- Interactively select items in a fast, keyboard-driven UI
Think of it as:
“Ctrl + F for your terminal, but much smarter.”
2. What “Fuzzy” Means
Traditional search:
fzf fuzzy search:
fzf will still match:
Because it matches characters in order, not strictly contiguous.
3. Installing fzf
macOS (recommended)
Then enable key bindings:
Choose yes for shell key bindings and completion.
Linux
or
Check installation
4. Your First fzf Command
Basic usage
What happens:
lsoutputs filenamesfzfdisplays them in an interactive list- You type → list filters instantly
- Press Enter → selected item is printed
5. Basic fzf Interface
When fzf opens:
| Key | Action |
|---|---|
| Type | Fuzzy filter |
| ↑ / ↓ | Move selection |
| Ctrl + j / k | Move selection |
| Enter | Confirm |
| Esc / Ctrl + c | Exit |
6. Useful Built-in Key Bindings (VERY IMPORTANT)
After installation, fzf integrates deeply with your shell.
Ctrl + T — File picker
Select a file → it is inserted into the command line.
Ctrl + R — Command history search
Search your shell history interactively.
This alone makes fzf worth installing.
Alt + C — Directory jump
Quickly jump to any directory.
7. Common Practical Examples
Open a file with vim
cd into a directory
Kill a process
Git branch switch
8. Preview Window (Game Changer)
fzf can show a preview pane.
Preview files
Preview directories
Syntax-highlight preview (if you have bat)
9. Search Inside Files (ripgrep + fzf)
Install ripgrep:
Search file contents:
Advanced:
10. fzf with Git (Very Common)
Search git commits
Search changed files
11. Environment Variables (Simple Customization)
Example:
Common options:
--height=40%→ floating window--layout=reverse→ prompt at bottom--border→ nicer UI
12. fzf Completion
After installation, fzf replaces default shell completion.
Example:
You’ll get an interactive fzf menu.
Works with:
cdsshkillgit checkout- many more
13. When Should You Use fzf?
Use fzf when:
- You have too many files
- You forget exact names
- You want speed without mouse
- You live in the terminal (Git, SSH, Docker, logs)
14. fzf vs grep vs find
| Tool | Best for |
|---|---|
| grep | Scriptable text search |
| find | File system queries |
| fzf | Interactive selection |
fzf does not replace them — it enhances them.
15. Minimal Daily Workflow Example
16. Summary
- fzf is a fuzzy interactive selector
- Works with stdin / stdout
- Integrates deeply with your shell
- Key bindings: Ctrl-T, Ctrl-R, Alt-C
- Becomes addictive very quickly 😄