Add auto-completion in Bash terminal using Fish shell
The default terminal shell you get in Linux systems is pretty basic and bare-bones. For instance, in Ubuntu, the default shell is GNU Bash and while it can get your job done, it lacks some of the power user features.
One of the features that I was really missing is auto-completion of commands. It’s not there in the default Bash shell.
How would you get that in your terminal? Well, it turns out you can use third-party shells. Many let you add this capability but the one I’m going to talk about is called Fish shell.
What is Fish shell?
Fish is a smart and user-friendly command-line shell for Linux, macOS, and the rest of the family. Among many incredible features, fish suggests commands as you type based on history and completions, just like a web browser.
Apart from this, fish supports 24 bit true color which is incredible. Okay, enough talk. Let’s see how you can install Fish and get up and running with it.
You can install fish on your operating system by referring to its homepage.
In my case, I’m using Ubuntu, so all I need to run is the following command to install Fish.
$ sudo apt-get install fish
And that is it! Fish is now installed on my system. I confirmed it by running the following command in my terminal.
$ fish -v
This will essentially show you which version of Fish has been installed on your system. And now you’re pretty much ready to use it.
Using Fish for autocompletion
Once installed, you can enter into the Fish shell by running the following command.
Here’s how the terminal looks like when running this command.
On a first impression, the shell just looks like your regular shell but under the hood, it encompasses a lot of superpowers that you can take advantage of.
The autosuggestions or tab completion works out-of-the-box in Fish without having you add/update any configs.
Here’s how the directory autocompletion looks like in Fish.
Here’s how command autocompletion looks like…
Here’s one more…
Make Fish your default shell
You can avoid entering the Fish shell manually using the
fish command by adding the command right into your terminal’s config file.
In my case, I added
fish at the end of the
~/.bashrc file and now when I open the bash terminal, Fish is the default shell that gets opened with it.
Like this article? Consider leaving aTip