DEV Community

Nirupamvas
Nirupamvas

Posted on

How to Install Most Interactive Shell On A Linux Machine

Alt Text

Hello Guys, I am Nirupamvas and I am back again with an other awesome Linux tutorial. So let's get started.

Before getting into it, let's understand some of the things

What Is Shell??

A shell is an interface to the underlying operating system. It allows you to execute operations using text and commands, and it provides users with advanced features like being able to create scripts.
Unix Shell is a powerful tool that allows programmers to accomplish complex tasks with just a few words. There are a lot of widely available Shells such as Bourne Shell, C Shell, etc.

So, everytime you want to execute a command you need to type entire command, I think this is one messy thing we need to do each and every time. To boost productivity and to save time for our lazy squad we have something called Fish. So let's see what is it all about.

What is FISH?

Fish, or the “Friendly Interactive Shell,” is the most user-friendly and interactive shell, in my opinion.
It is much more customizable than Zsh and Bash. It has a ton of cool features like consistent syntax, nice tab completion and syntax highlighting, is easy to pick up and use, and has excellent runtime help.
You can change the theme and color of your shell just by using a framework called Oh My Fish. Unlike the aforementioned shells, fish is not POSIX compliant, but it also doesn’t intend to be.
You can run Bash scripts in both Zsh and fish by adding the following shebang line to the first line of your Bash file.

Let's start our installation,

  • Step 1 : Download Fish
sudo apt-get install fish
Enter fullscreen mode Exit fullscreen mode
  • Step 2 : Entering into Fish

You can now enter the Fish shell simply by typing

fish
Enter fullscreen mode Exit fullscreen mode
  • step 3 : Setting Fish as your default shell

You can set Fish as your default shell instead of Bash:

chsh -s /usr/bin/fish
Enter fullscreen mode Exit fullscreen mode

This way, Fish will be used automatically every time you log in. Test this setting by exiting SSH, then logging back in. Upon logging in, you will be presented with a Fish shell.

  • Step 4: Creating a config file

In order to be able to change the properties of the Fish shell, we first need to create a config file.

mkdir -p ~/.config/fish
vim ~/.config/fish/config.fish
Enter fullscreen mode Exit fullscreen mode
  • Step 5: Removing the default message

By default, Fish will show this message when you enter the shell:

Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
Enter fullscreen mode Exit fullscreen mode

You can remove this message by adding the following to the ~/.config/fish/config.fish file:

set -g -x fish_greeting ''
Enter fullscreen mode Exit fullscreen mode

It will pop up either vim or nano, in any case type 'I' and start editing and to save type
ESC then :wq then Hit enter
This will remove the message and rather set it to a blank value. You can add something such as "Welcome to Terminal!" by entering a value instead of leaving it blank:

set -g -x fish_greeting 'Welcome to Terminal!'
Enter fullscreen mode Exit fullscreen mode

If you do not like in any case what you do is, simply uninstall, so how to do that, see below.

  • Step 6: Switching back to Bash If you would like to use Bash again, simply type:
bash
Enter fullscreen mode Exit fullscreen mode

If you want to permanently use Bash as your default shell, type:

chsh -s /bin/bash
Enter fullscreen mode Exit fullscreen mode

BONUS
This will not only work on Virtual machines or Fully installed linux but also in Windows Subsystem for Linux.

That's it, now you are good to go!! Hope you enjoy 😎.

Top comments (1)

Collapse
 
mccurcio profile image
Matt Curcio

Nice tutorial and introduction to Fish.
Thanks