How to install and use FZF

FZF is a fuzzy finder that can be used to autocomplete and find stuff at the shell. It has a beautiful ncurses interface, sensible keybindings and is blazing fast. It truly supercharges your shell use and you will not be able to live without it after.

  • To install FZF and install its hooks into Bash, Zsh and Fish shells:
$ git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
$ ~/.fzf/install
  • Find files and directories: At the shell prompt, press Ctrl+T and FZF scans the files and directories inside your current directory and starts filling up its list. Type a few characters of the file or directory you want to autocomplete. The characters do not need to be an exact substring. That is the fuzzy feature of this finder. Use up and down keys to navigate the list. You can even use the mouse to pick items from the list by clicking and Ctrl-clicking. Finally press Enter to pick the entry you want. Press Esc to dismiss FZF any point.

  • Find directories: At the shell prompt, press Alt+C to autocomplete and find only directories. The rest of the interaction is same as that for Ctrl+T shown above.

  • Find from history: Ctrl+R does the fuzzy finding for commands from your shell history. This works in Bash, but seems to be disabled in Fish. No worries cause Fish already has powerful history search.

  • Find process to kill: Figuring out the PID of a process you want to kill is painful. With FZF, all you need to do is type kill, press TAB and you get a list of processes with full details. You can type some characters to find the process you want or scroll the list. For each item, it also shows the full command line at the bottom, enabling you choose the right program to kill. Press Enter to choose the process. Its PID will be added to your kill command.

Tried with: FZF 0.17.1 and Ubuntu 16.04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s