| name | fzf-fuzzy-finder |
| description | Command-line fuzzy finder for interactive filtering and selection - integrates with shell, vim, and other tools. |
| homepage | https://github.com/junegunn/fzf |
| metadata | {"clawdbot":{"emoji":"🔮","requires":{"bins":["fzf"]},"install":[{"id":"brew","kind":"brew","formula":"fzf","bins":["fzf"],"label":"Install fzf (brew)"},{"id":"apt","kind":"apt","package":"fzf","bins":["fzf"],"label":"Install fzf (apt)"}]}} |
fzf - Fuzzy Finder
Interactive command-line fuzzy finder with powerful integration capabilities.
Basic Usage
Simple filtering
ls | fzf
find . -type f | fzf
ls | fzf -m
ls | fzf --preview 'cat {}'
ls | fzf --preview 'bat --color=always {}'
Shell integration
vim **<TAB>
cd **<TAB>
kill -9 **<TAB>
Common Patterns
File selection
vim $(fzf)
vim $(fzf --preview 'bat --color=always --line-range :500 {}')
fzf | xargs -I {} cp {} /destination/
fzf -m | xargs rm
Directory navigation
cd $(find . -type d | fzf)
alias cdf='cd $(find . -type d | fzf)'
Git integration
git branch | fzf | xargs git checkout
git log --oneline | fzf | awk '{print $1}' | xargs git show
git status -s | fzf -m | awk '{print $2}' | xargs git add
alias gll='git log --oneline | fzf --preview "git show {1}"'
Process management
ps aux | fzf | awk '{print $2}' | xargs kill
ps aux | fzf -m | awk '{print $2}' | xargs kill -9
Advanced Features
Preview window
fzf --preview 'cat {}'
fzf --preview 'cat {}' --preview-window=right:50%
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
fzf --preview 'cat {}' --bind 'ctrl-/:toggle-preview'
find . -type d | fzf --preview 'ls -la {}'
Custom key bindings
fzf --bind 'enter:execute(vim {})'
fzf --bind 'ctrl-e:execute(vim {})' \
--bind 'ctrl-o:execute(open {})'
fzf --bind 'ctrl-r:reload(find . -type f)'
fzf --print0 --bind 'enter:print-query'
Filtering options
fzf -i
fzf +i
fzf -e
fzf --query='!pattern'
fzf --query='py$ | js$'
fzf --query='test .py'
Integration Examples
With ripgrep
rg --line-number . | fzf | awk -F: '{print "+"$2, $1}' | xargs vim
rg --line-number . | fzf --delimiter : \
--preview 'bat --color=always {1} --highlight-line {2}' \
--preview-window +{2}-/2
With fd
fd --type f | fzf --preview 'bat --color=always {}'
fd --changed-within 1d | fzf --preview 'bat {}'
With docker
docker ps | fzf | awk '{print $1}' | xargs -I {} docker exec -it {} bash
docker images | fzf -m | awk '{print $3}' | xargs docker rmi
docker ps | fzf | awk '{print $1}' | xargs docker logs -f
With kubectl
kubectl get pods | fzf | awk '{print $1}' | xargs kubectl describe pod
kubectl get pods | fzf | awk '{print $1}' | xargs kubectl logs -f
kubectl get pods | fzf -m | awk '{print $1}' | xargs kubectl delete pod
Useful Aliases
Add to your shell config:
alias fv='vim $(fzf --preview "bat --color=always --style=numbers {}")'
alias fcd='cd $(find . -type d | fzf)'
alias gco='git branch | fzf | xargs git checkout'
alias fkill='ps aux | fzf | awk "{print \$2}" | xargs kill -9'
alias fh='history | fzf | awk "{print \$2}" | xargs -I {} sh -c "{}"'
alias fe='fd --type f | fzf --preview "bat --color=always --style=numbers {}" | xargs -r $EDITOR'
Configuration
Environment variables
export FZF_DEFAULT_OPTS='
--height 40%
--layout=reverse
--border
--inline-info
--preview "bat --style=numbers --color=always --line-range :500 {}"
'
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND='fd --type d --hidden --follow --exclude .git'
Color scheme
export FZF_DEFAULT_OPTS='
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc
--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8
'
Advanced Workflows
Project file browser
fzf \
--preview 'bat --color=always --style=numbers --line-range=:500 {}' \
--preview-window='right:60%:wrap' \
--bind 'enter:execute(vim {})' \
--bind 'ctrl-y:execute-silent(echo {} | pbcopy)+abort' \
--header 'Enter: edit | Ctrl+Y: copy path'
Multi-purpose search
rg --line-number --no-heading . | \
fzf --delimiter=: \
--preview 'bat --color=always --style=numbers --highlight-line {2} {1}' \
--preview-window='+{2}-/2' \
--bind 'enter:execute(vim {1} +{2})'
Docker container manager
#!/bin/bash
container=$(docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" | fzf --header-lines=1 | awk '{print $1}')
if [ -n "$container" ]; then
docker exec -it "$container" bash
fi
Tips
- Use
--preview for visual context
- Combine with
bat, rg, fd for powerful workflows
- Press
? in fzf to see keybindings
- Use
Tab for multi-select
Ctrl+/ to toggle preview (if bound)
Ctrl+K / Ctrl+J to navigate
- Start query with
' for exact match
- Start with
! to exclude
- Use
| for OR, space for AND
- Set
FZF_DEFAULT_OPTS for persistent config
Performance
export FZF_DEFAULT_COMMAND='fd --type f'
export FZF_DEFAULT_COMMAND='fd --type f --max-depth 5'
fzf --preview 'bat {}' --preview-window 'hidden'
Documentation
GitHub: https://github.com/junegunn/fzf
Wiki: https://github.com/junegunn/fzf/wiki
Examples: https://github.com/junegunn/fzf/wiki/examples