Follow ZDNET: Add us as a favorite source On Google.
ZDNET Highlights
- The Linux shell enables communication with the kernel.
- The default shell for most distributions is Bash.
- There is a much more user-friendly alternative, called Phish.
Essentially, the Linux shell interprets commands so that the kernel can understand and use them. Without a shell, not only commands will not work, but applications will not work as well.
So yes, the shell is very important.
Most Linux distributions default to the Bash shell, which stands for Bourne Again Shell. Why “Bourne”? Because the Bourne shell was the first shell, and Bash is an improvement on it. With Bash, you can write Bash scripts that can do almost anything. However, Bash has been around for a very long time, and hasn’t really changed much.
Also: I was happy to be reunited with my first Linux distro at the Virtual OS Museum
The good news is that alternatives exist, and one of those alternatives includes features that Bash has neglected. That shell is called FISH (Friendly Interactive Shell). The big difference between bash and fish is that bash feels like it works for you, and fish feels like it works with you.
This may not make sense at first, but let me explain.
difference between bash and fish
When you run a command in Bash, you type it, press Enter, and wait to see if it works. Bash doesn’t help you; It just accepts the command and attempts to run it. That’s it.
Fish behave a little differently. When you start typing a command in Fish, it will make suggestions (based on your history). When you see a suggestion that works for you, press the right-pointing arrow key to accept the suggestion. For example, you can type ssh, And the fish will then offer a suggestion like ssh 192.168.1.26. Press the arrow keys and then press Enter.
Too: The first 5 Linux commands every new user should learn
You might have also noticed that fish use colors. For example, if you type an invalid command, Fish will color it red. If you change an invalid command to make it valid, it turns blue.
If you start typing the file path, it will appear red, and as the path is validated, it will turn blue.
When you start typing a command, pressing Tab will display several suggestions. You can then use your arrow keys to scroll through the list and select the command you want to run.
You can also set variables in fish with this set Permission. For example, if I want to set a variable called Name As per my name, I can type:
set name jack
Now, I can use that variable like this:
echo “My name is $name”
Also: Why Wave is my new terminal app – how I use this powerful tool
The reaction will be:
my name is jack
Fish is user-friendly in other ways. For example, in Bash, you use the back tick (`) to indicate a command, which can often be confusing. In Fish, commands are placed in parentheses like this:
echo (whammy) in (pwd)
The results of the above command will be:
jack in /home/jack
You can also set abbreviations for commands (similar to aliases in Bash). Let’s say you use git checkout Order a lot and want to make it a little more efficient. If you wanted to make gco the abbreviation for that command, it would be:
abbr–gco add git checkout
Or you can set multiple ssh abbreviations, like:
abbr–ssh11 add “ssh 192.168.1.11”
abbr–ssh12 add “ssh 192.168.1.12”
Now, when you type ssh11, you will be connected to 192.168.1.11, and if you type ssh12, you will be connected to 192.168.1.12.
Too: Best Linux Distros for Beginners
Those abbreviations persist even after you log out.
Fish also includes a handy calculator. For example, you can type:
Math 5020/220
The answer (22.818182) will be presented at the prompt.
Installing and Setting Up the Fish Shell
Fish can be installed from your distribution’s standard repository. For example, in Ubuntu, the command to install fish would be:
sudo apt-get installfish -y
On Fedora, that command is:
sudo dnf install fish-y
On Arch, the order is:
sudo pacman -s fish
Once you have installed Fish, you need to set it as the default shell with the command:
chsh -s$(which fish)
Also: 5 Surprisingly Productive Things You Can Do With the Linux Terminal
If you don’t like fish (you will), you can convert it back to bash:
chsh -s $(which bash)
And that is a fish shell. Remember, if you teach someone to fish… you empower them for life.
