Monday, September 1, 2014

Fish: An Alternative to Bash 

Have you ever wanted to get away from Bash when using Linux? It’s understandable. Though Bash is often praised as being a great shell, it has a lot of shortcomings. Enter Fish shell. It’s a great alternative with tons of neat features. The most notable being predictive type. Other handy features include syntax highlighting, searchable command history and auto suggestions.
Ubuntu
sudo apt-get install fish
 
Arch Linux
sudo pacman -S fish
 
OpenSUSE
sudo zypper install fish
 
Fedora
sudo yum install fish
 
Find it on GitHub
Can’t find it for your distro? Looks like you might have to build it yourself. Visit the Fish shell GitHub page. They’ve got some detailed instructions on how to build it.
Replacing Bash with Fish is as simple as a single command. Open your terminal of choice and execute the following command.
chsh -s /usr/bin/fish
Once this command has been entered, you’ll be asked to enter your password. Input it and Fish shell will take the place of Bash as your default.
fish-shell-make-default-over-bash
Now that Fish is the default, it’s time to switch to it. Yes, you could just close your terminal window and then re-open it. It’s a lot faster to just type the command below and immediately switch to it.
Fish
 
 
fish-shell-swap-from-bash-to-fish
As stated above, Fish is very user friendly. Just start typing. It’ll guess. Want to type in the pacman command? Chances are it’ll fill it out for you. All you’ve got to do is hit the right arrow on your keyboard and let it auto-complete. This feature is very powerful. It doesn’t just work with system commands (like packagers) but with any command or terminal program available. If it’s installed on your system in some way, Fish will find it and let you know about it.
fish-shell-auto-suggestion-feature
Fish really doesn’t need that much configuration. From the start everything should be set up exactly the way you need. There is, however, one small tweak that can make your Fish experience that much better: Disabling the startup message. Though helpful, it can get pretty annoying to see every single time you open a new terminal window.

Welcome to fish, the friendly interactive shell
 
Type help for instructions on how to use fish
 
To disable, start by making the Fish shell configuration directory.

mkdir -p ~/.config/fish
 
After making the directory, it’s time to make the configuration file.

nano ~/.config/fish/config.fish
 
Paste the code below into the nano window and press “Ctrl + o” to save. When saved, the greeting will never show up while opening a new terminal window.
set fish_greeting ""
Along with the configure file, it’s also possible to configure Fish with its web interface. Simply open a terminal and enter the command below to be taken to it.
fish_config
 
fish-shell-web-interface-configuration-window
The web interface allows for many, many customization options. Too many to list here!
While Bash is a good shell, Fish is better. It makes up for a lot of the shortcomings Bash and other shells have. The auto-complete function is a lifesaver, and the robust configuration options are a welcome addition. The shell is very fast and light on it’s feet. Sure, there are other alternatives, and maybe even some that boast equivalent features, but where Fish wins is its simplicity. It’s easy to set up, easy to configure and easy to get stuff done.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.