fzf 설치: 키 바인딩, 셸 히스토리 검색, Ctrl+R 비교
fzf 설치·key bindings 후 fzf 히스토리와 Ctrl+R 차이 이해.
Ctrl+R reverse search walks history one match at a time; tab completion rarely shows a preview. fzf (Junegunn, Go) turns any list into a fuzzy filter UI. With official shell key bindings, Ctrl+R becomes searchable history, Ctrl+T picks files, and Alt+C jumps directories. This guide covers installing fzf, enabling key bindings, and fzf history vs plain Ctrl+R for hereink readers who already use fd, rg, and bat—not a ripgrep tutorial.
The query is fzf 설치 키 바인딩 Ctrl+R 히스토리 검색. You should finish with fzf on PATH, bindings sourced in bash/zsh, sensible FZF_* options, and when to keep the shell’s built-in reverse search.
What fzf fixes
Fuzzy pick, not exact prefixes
Type deploy nginx to surface ./scripts/deploy-staging-nginx.sh. Pipes like fd | fzf or git branch | fzf use the same UI.
Pairs with fd and rg
fd lists paths, rg searches content, fzf chooses one row. Example: rg -l TODO | fzf --preview 'bat {}' when bat is installed.
Upstream:
github.com/junegunn/fzf. Runfzf --versionafter install.
Install on macOS and Linux
- 1macOS (Homebrew)
brew install fzf. The binary lands on PATH; key bindings need a second step (next section). - 2Debian / Ubuntu
sudo apt update && sudo apt install fzf. Distro packages can lag; clone from GitHub and run theinstallscript if you need the latest (official README). - 3Fedora / Arch
sudo dnf install fzforsudo pacman -S fzf. - 4First interaction
Anywhere:
ls | fzf. Type to filter, Enter prints the selection to stdout, Esc aborts.
Enable shell key bindings
After Homebrew install, run the upstream installer (path may vary slightly):
"$(brew --prefix)/opt/fzf/install"
"$(brew --prefix)/opt/fzf/install" --all # non-interactive; read flags firstThe script offers key bindings and completion. Accepting adds source …/key-bindings.bash or .zsh to your rc file. Restart the shell or source ~/.zshrc.
Default shortcuts (bash / zsh)
Ctrl+R command history (fuzzy)
Ctrl+T fuzzy file pick under cwd, insert on the line
Alt+C fuzzy directory, then cd (Option as Meta on macOS terminals)
# Direct invocation still works
fzf
history | fzf
git log --oneline | fzfIf Alt+C fails in Terminal.app, enable “Use Option as Meta key” or use iTerm2/Alacritty with Option set to Meta.
fzf history vs plain Ctrl+R
| Aspect | Built-in Ctrl+R | fzf-bound Ctrl+R |
|---|---|---|
| UI | inline reverse-i-search | full-screen list with fuzzy scoring |
| Matching | mostly contiguous substrings | fuzzy gaps, e.g. gco main → git checkout main |
| Preview | none | FZF_CTRL_R_OPTS --preview can show the full command |
| Multi-select | no | history binding is usually single; pipe with fzf -m for many |
| Dependencies | shell built-in | requires fzf + sourced key-bindings |
| Minimal SSH | always there | skip bindings if fzf is not installed |
To use fzf on history without hijacking Ctrl+R, decline binding during install and bind history | fzf to another key.
Useful environment variables
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border --info=inline'
export FZF_CTRL_T_OPTS='--preview "bat --color=always {} 2>/dev/null | head -200"'
export FZF_CTRL_R_OPTS='--preview "echo {}" --preview-window down:3:hidden:wrap --bind "?:toggle-preview"'FZF_DEFAULT_COMMAND feeds Ctrl+T. Without fd, point it at find or git ls-files; see our fd install note.
- Good fit
- Daily “find one line then run it” workflows; terminals already using fd/rg/bat.
- Not ideal
- Hosts where you cannot install binaries—keep default Ctrl+R; plain POSIX sh without bash/zsh bindings.
Overlap with the ripgrep articles?
No. Ripgrep posts cover content search in repos; this one covers interactive selection. Combine with rg -l | fzf, but we do not teach rg flags here.
Ctrl+R unchanged after install?
Confirm key-bindings are sourced, shell is bash/zsh, and no other plugin re-binds Ctrl+R. Check type fzf and bindkey | grep fzf on zsh.
Use fzf without overriding Ctrl+R?
Yes—skip bindings in install or comment out the source line; map history | fzf to a free shortcut.
Windows?
Official path is Git Bash / WSL; PowerShell ports exist in the community. Steps here target macOS/Linux bash/zsh.
터미널 다음, 다이어그램 맞추기
Service boundaries are easier on a shared board. See create a space.