Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 1003 Bytes

enable-multi-select-of-results-with-fzf.md

File metadata and controls

25 lines (18 loc) · 1003 Bytes

Enable Multi-Select Of Results With fzf

You can pipe the output of any command to fzf and it will display it line-by-line in a list that you can then fuzzy-find against.

By default you get to pick one of those results. That result will go to stdout, either printing to the terminal or being piped to the next command.

For some combinations of commands, it makes more sense to be able to select multiple results. fzf supports this with the -m (or --multi) flag.

$ ls | fzf -m | xargs cat

For instance, this series of commands pipes the output of ls (files and directoris) to fzf. The -m flag means that you can hit Tab (or Shift+Tab) to select multile entries. When you hit enter, each of the selected entries will be executed one by one with cat.

I show a slightly more practical example of this in Make One-Line Commands Interactive with fzf.

See man fzf for more details.