bat and fzf: A Terminal Workflow to Replace grep-and-scroll File Searches
Developers who rely on grep to search large codebases often waste time scrolling through floods of output to locate a single file or line. Two command-line tools, bat and fzf, can be combined to create a faster, interactive file-search workflow directly in the terminal. bat enhances standard file viewing with syntax highlighting, line numbers, and git change indicators, while fzf provides a fuzzy-search interface that filters results as you type. A shell function called 'fe' pipes fzf's fuzzy finder with bat's live preview pane, allowing developers to locate and open files in their editor without knowing the exact path. The tools are available via Homebrew on macOS and apt on Linux, with Ubuntu users needing to alias 'batcat' to 'bat' due to a package naming conflict.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in