Linux command
fzf 命令
文件
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Interactive file finder
find . -type f | fzf
Select with preview
fzf --preview 'cat {}'
Multiple selection
fzf -m
Filter command history
history | fzf
Fuzzy find and
vim $(fzf)
Exact match
fzf -e
Non-interactive filter
fzf -f "[query]"
Auto-select single
fzf --select-1 -q "[query]"
说明
fzf is a general-purpose fuzzy finder that filters any list interactively. It accepts input via stdin and outputs selected items, enabling powerful shell workflows. The tool provides instant feedback while typing, fuzzy matching for typo tolerance, and preview windows for context. Shell integration adds keybindings for history, files, and directories. fzf transforms command-line workflows with interactive selection for files, processes, git branches, and more.
参数
- -m, --multi
- Enable multiple selection.
- --preview _CMD_
- Preview command.
- -q _QUERY_, --query _QUERY_
- Initial search query.
- --height _HEIGHT_
- Display height (rows or percentage).
- --reverse
- Layout from top.
- --border
- Draw border.
- -e, --exact
- Enable exact-match mode instead of fuzzy.
- -f _QUERY_, --filter _QUERY_
- Non-interactive filter mode (fuzzy grep).
- -1, --select-1
- Auto-select if only one match.
- -0, --exit-0
- Exit immediately if no match.
- --ansi
- Enable ANSI color code processing.
- -d _DELIM_, --delimiter _DELIM_
- Field delimiter regex for --nth.
- -n _N_, --nth _N_
- Limit search scope to specified fields.
- --layout _LAYOUT_
- Display layout: default, reverse, reverse-list.
- --info _STYLE_
- Info display style: default, right, hidden, inline.
- --header _STR_
- Display a sticky header string.
- --bind _KEYS_
- Custom key bindings.
- --tac
- Reverse input order.
- --no-sort
- Preserve original input order.
- --cycle
- Enable cyclic scrolling.
- --print-query
- Print the query as the first output line.
- --help
- Display help information.
FAQ
What is the fzf command used for?
fzf is a general-purpose fuzzy finder that filters any list interactively. It accepts input via stdin and outputs selected items, enabling powerful shell workflows. The tool provides instant feedback while typing, fuzzy matching for typo tolerance, and preview windows for context. Shell integration adds keybindings for history, files, and directories. fzf transforms command-line workflows with interactive selection for files, processes, git branches, and more.
How do I run a basic fzf example?
Run `find . -type f | fzf` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -m, --multi do in fzf?
Enable multiple selection.