λDennis-Tanui-V0.0.80[0:HOME]1[1:POSTS]2[2:PROJECTS]3[3:ABOUT]
➜~/blogs/mastering-fzf-filters

Mastering fzf filters for workflow automation

·
#cli#automation#fzf
Mastering fzf filters for workflow automation

The problem

Every morning I run the same five commands: jump to project, search for a file, grep for a pattern, open in editor, deploy. That's five keyboard-full commands before any real work starts.

Enter fzf

fzf is a general-purpose fuzzy finder that turns any list into an interactive search. Pipe a list, type a pattern, and the match narrows in real time.

bash
git log --oneline | fzf --preview 'git show {1}'

This lets you scroll through commits with a live diff preview. Select one and hit enter — now you've got the commit hash ready to pipe into another command.

Building a pipeline

The real power comes from chaining:

bash
# Interactive file search with preview
function ff() {
  local file
  file=$(fd --type f | fzf --preview 'bat --color=always {}')
  [ -n "$file" ] && $EDITOR "$file"
}

This single function replaces find, grep, and manual file navigation.

Key takeaways

  • Start with --preview — it's the killer feature
  • Pipe selections into subsequent commands for chaining
  • Use fd (not find) for faster file discovery

Related Posts