Forget Your Terminal History: Faster Terminals with fzf and Fish

Searching through a messy .bash_history using Ctrl+R is a slow, literal process that breaks the moment you make a typo. If you want a modern terminal experience—complete with fuzzy searching, real-time syntax highlighting, and IDE-style autosuggestions—you don’t need a complex setup. You just need two industry-standard tools: fzf and Fish.

Here is how to install and configure both using the official Debian/Ubuntu repositories.

1. Install and Configure fzf (via apt-get)

Installing fzf through the official package manager is the most stable method, but it requires a manual step to activate the keybindings. Since apt stores the configuration scripts in the documentation folder, you must tell your terminal to load them.

Install the package:

sudo apt-get update
sudo apt-get install fzf

Enable the Ctrl+R history search and fuzzy auto-completion:
Copy and paste this block into your terminal to update your .bashrc:

cat << 'EOF' >> ~/.bashrc
if [ -f /usr/share/doc/fzf/examples/key-bindings.bash ]; then
    source /usr/share/doc/fzf/examples/key-bindings.bash
fi
if [ -f /usr/share/doc/fzf/examples/completion.bash ]; then
    source /usr/share/doc/fzf/examples/completion.bash
fi
EOF

Apply the changes:

source ~/.bashrc

2. Install Fish Shell

Fish (the Friendly Interactive Shell) provides a much smarter experience than standard Bash. It offers “autosuggestions” (faint gray text) that predict what you want to type based on your history, even for commands you haven’t used recently.

Install the shell:

sudo apt-get install fish

Start using it:
Simply type fish in your terminal to enter the shell.

Set as your default shell (Optional):
If you want Fish to open every time you launch your terminal, run the following (you will need to log out and back in for this to take effect):

chsh -s /usr/bin/fish

Leave a Reply

Your email address will not be published. Required fields are marked *

Posted

in

Tags: