Install and use fzf

Reading time ~1 minute

fzf is a general-purpose command-line fuzzy finder. Let’s install and make you 10 times more productive!

install fzf

# clone into ~/.fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
# run install command
~/.fzf/install

output: answer “y” to enable auto-completion and key bindings

Cloning into '/home/naoko/.fzf'...
remote: Enumerating objects: 101, done.
remote: Counting objects: 100% (101/101), done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 101 (delta 4), reused 28 (delta 2), pack-reused 0
Receiving objects: 100% (101/101), 180.78 KiB | 1.83 MiB/s, done.
Resolving deltas: 100% (4/4), done.
Downloading bin/fzf ...
  - Found in $PATH
  - Creating symlink: bin/fzf -> /usr/bin/fzf
  - Checking fzf executable ... 0.20.0 != 0.21.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   637  100   637    0     0   1750      0 --:--:-- --:--:-- --:--:--  1750
100 1127k  100 1127k    0     0   991k      0  0:00:01  0:00:01 --:--:-- 2597k
  - Checking fzf executable ... 0.21.1
Do you want to enable fuzzy auto-completion? ([y]/n) y
Do you want to enable key bindings? ([y]/n) y

Generate /home/naoko/.fzf.bash ... OK
Generate /home/naoko/.fzf.zsh ... OK

Do you want to update your shell configuration files? ([y]/n) y

Update /home/naoko/.bashrc:
  - [ -f ~/.fzf.bash ] && source ~/.fzf.bash
    + Added

Update /home/naoko/.zshrc:
  - [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
    + Added

Finished. Restart your shell or reload config file.
   source ~/.bashrc  # bash
   source ~/.zshrc   # zsh

Use uninstall script to remove fzf.

For more information, see: https://github.com/junegunn/fzf

Let’s play

Key Binidngs

  • ctl + r: fuzzy find thorugh your command history
  • ctl + t: fuzzy find through the current directory

** trigger command + tab

It understand context and list only relative stuff. eg:

  • cd ** + tab
  • ssh ** + tab

Cheers!

Refinance

Great tools to decided refnanice Continue reading

Smile every time you sudo

Published on February 18, 2021

Don't let your money sleep

Published on December 20, 2020