Are you tired of using the same old bash shell and looking for something more interactive and user-friendly? Look no further than Fish shell! In this blog, we will walk you through the steps to install Fish shell on any Linux distro and give you some tips on how to use it effectively.
What is Fish Shell?
Fish shell is a shell program for Unix-like operating systems. It is designed to be more user-friendly and interactive than other shell programs such as bash. Some of the features that make Fish stand out include:
- Syntax highlighting: Fish shell syntax is highlighted in different colors to make it easier to read and understand.
- Autosuggestions: Fish shell automatically suggests commands as you type, based on your history and the structure of the command.
- Web-based configuration: Fish shell has a web-based configuration tool called “fish_config” which makes it easy to customize the shell to your liking.
How to Install Fish Shell
Installing Fish shell is easy and can be done with just a few commands. Here’s how to do it on different Linux distros:
Ubuntu and Debian
To install Fish on Ubuntu or Debian, you can use the following commands:
sudo apt update
sudo apt install fish
Rocky Linux and Fedora
To install Fish on Rocky Linux or Fedora, you can use the following commands:
sudo dnf update
sudo dnf install fish
To install Fish on Arch Linux, you can use the following command:
sudo pacman -S fish
For other Linux distros, you can check the official Fish shell website for installation instructions: https://fishshell.com/docs/current/index.html#installation
Switch to Fish
To switch from your current shell to the fish shell, you can use the
fish command in your terminal.
You can also use the
chsh command to change your default shell to fish. The command would be:
chsh -s $(which fish)
This will change the default shell to fish for the current user.
Please note that you may need to log out and log back in for the changes to take effect.
Also, you can check your current shell by using
echo $SHELL command and it will show the path of your current shell.
Tips for Using Fish Shell
Now that you have Fish shell installed, you might be wondering how to use it effectively. Here are a few tips to get you started:
- Use the “alias” command to create shortcuts for frequently used commands. For example, you can create an alias for “ls -al” as “la” by typing the following command:
alias la='ls -al'.
- Use the “funced” command to edit functions in Fish shell. For example, you can edit the “ls” function by typing
- Use the “fish_config” command to customize the look and feel of Fish shell. You can change the color scheme, enable/disable features, and more.
- Use the “set -l” command to create global variables in Fish shell. For example, you can set the “EDITOR” variable to your preferred text editor by typing
set -l EDITOR nano.
- Use the “fish_vi_key_bindings” command to enable vi-style key bindings in Fish shell. This can be helpful if you are used to using vi or vim as your text editor.
Increase Productivity with Fish Shell
There are many ways you can use Fish shell to increase your productivity and efficiency as a developer or system administrator. Here are a few examples:
- Use the autosuggestions feature to quickly type out long or complex commands.
- Use the syntax highlighting to easily identify and fix mistakes in your commands.
- Use the “alias” command to create shortcuts for frequently used commands, saving you time and effort.
- Use the “funced” command to easily edit and modify functions, making it easier to automate tasks.
- Use the “set -l” command to create global variables that you can use in your commands, reducing the need to type out long or complex paths or arguments.
Now that you have learned how to install and use Fish shell, it’s time to put your new skills to the test. Try installing Fish shell on your Linux machine and see if you can use it to increase your productivity and efficiency. Here are a few challenges to get you started:
- Create an alias for a commonly used command.
- Use the “funced” command to edit a function.
- Customize the look and feel of Fish shell using the “fish_config” command.
- Create a global variable using the “set -l” command and use it in a command.
- Enable vi-style key bindings using the “fish_vi_key_bindings” command.