fzf is a serious timesaver. To be able to quickly go through past commands and in a fuzzy manner, especially when you don’t recall the exact command is a Godsend!

To install fzf on Linux, we need to

a) clone the repository into the system

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf

b) run the command which will add the relevant shortcut keys

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
~/.fzf/install --all
~/.fzf/install --all
~/.fzf/install --all

There are a bunch of other stuff that can be done once fzf is installed. For example, to see instant file previews –

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
fzf --preview 'less {}'
fzf --preview 'less {}'
fzf --preview 'less {}'

And if there is bat also installed, then the previews can show syntax highlighting and line numbers also!

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
fzf --preview 'bat --color=always --style=numbers --line-range=:100 {}'
fzf --preview 'bat --color=always --style=numbers --line-range=:100 {}'
fzf --preview 'bat --color=always --style=numbers --line-range=:100 {}'