DEV Community


Posted on


Get along with fzf for Terminal

This is for my next Git post.
I started playing with .gitconfig and got known a great tool, fzf.
fzf can make things easy!!!

fzf is a general-purpose command-line fuzzy finder.

In this post, I will show what we can do, how to install and a couple of usages.

What We Can Do with fzf

In the following gif, I tried history first then I used h | fzf (h is an alias of history). As you can see, you can find out the command you want to see easily with fzf.
fzf allows us to use git checkout interactively like below.
In addition, you can customize commands with fzf and many people write scripts. In the bottom of this post, I put the link which is very useful for people who want to try fzf. You can also set shortcut keys.




This post supports MacOS and Ubuntu since I have used both of them.

# MacOS
$ brew install fzf

# Ubuntu
$ sudo apt-get install fzf
Enter fullscreen mode Exit fullscreen mode

If you are using Windows, I highly recommend you to start using chocolatey( which is a package manager software.

Simple Usage

File search

I did this command in my Gatsby site folder and searched my components.

$ fzf
$ fzf --reverse
Enter fullscreen mode Exit fullscreen mode


History search

This is very useful to me since I usualy do h | grep 'something' for checking commands I typed before.

$ history | fzf
$ history | fzf --reverse
Enter fullscreen mode Exit fullscreen mode


If you add --reverse you can change the layout like this(maybe better)

Open file with fzf

$ open $(fzf)
Enter fullscreen mode Exit fullscreen mode


Update package with fzf

Sometimes I do typo then get an install error lol

$ brew upgrade $(brew outdated | fzf)
# Then choose a package. Probably user --multi.
Enter fullscreen mode Exit fullscreen mode


jq with API

This is not helpful, but if we need to check a big json return from API with curl command, this might be good ???
By the way, for jq you need to instal jq.

$ curl\?lat\=35\&lon\=139\&appid\=b6907d289e10d714a6e88b30761fae22 | jq | fzf --reverse
Enter fullscreen mode Exit fullscreen mode


More Information


You can see more information here (

Key bindings for command-line

Suggestion from @vonheikemen

Top comments (1)

vonheikemen profile image

It is worth mention that fzf comes with a few handy functions to search the command history and also directories. You just need find and source the fzf/key-bindings.bash file (there is also one for zsh and fish). More info about it here.

Let's hear from your organization

Create an Organization and start sharing content with the community on DEV.