Better autocomplete in Linux terminal with Fish

Most Linux distributions (those using Bash) include auto-complete features in the terminal where you can type a few characters, press TAB and it’ll provide a best guess at what you’re trying to do.

Fish is better at that though, more info about it: http://fishshell.com/

Let’s install it from a PPA on Ubuntu (including Elementary OS and other Ubuntu derivatives), simply copy-paste the following into a terminal:

sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish

You can then test it out in that same terminal by typing ‘fish’. You’ll see one of its notable features right away, the auto-complete with syntax highlighting. It’s the main reason I use it, just type a few letters and hit tab to have it auto-complete.

fish

If you like it, replace it with the default (Bash) like so:

chsh -s /usr/bin/fish

or

chsh -s /usr/local/bin/fish

You can always switch back to the bash shell later too:

chsh -s /bin/bash

Mac users can have a read here: http://hackercodex.com/guide/install-fish-shell-mac-ubuntu/

And of course, Fish is highly configurable. Simply enter the following in your terminal:

fish_config

And your browser will open to a delightful graphical configuration screen.

fish_config

As you’ll see, you can configure colors, the prompt and other things as well as being able to interact with the terminal history and get info about environment variables and more.

A note about Elementary OS

Elementary OS includes a custom terminal app that integrates very neatly with the system pager so the system notifies you when tasks are completed in the terminal (such as when installing apps via apt-get or running updates). This works “out of the box” with Bash but not with Fish, not at this time.

Keep updated on progress here: https://github.com/fish-shell/fish-shell/issues/1382

Additional resources

For more info about command shells in general, here’s a good read: http://linuxcommand.org/lc3_lts0010.php

And of course, a great comparison of the popular shells: https://en.wikipedia.org/wiki/Comparison_of_command_shells

Adding to that comparison, a specific comparison of the more popular unix shells: http://hyperpolyglot.org/unix-shells

Enjoy the colorful Fish! 🙂

Advertisements
Better autocomplete in Linux terminal with Fish

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s