As much as this is something that most users do not give much importance, it is good to know that the Bash, despite being the standard and most popular command interpreter, it is not the only alternative you have, in fact, there are some other very interesting ones, like ZSH, that you will learn to configure today.
I am not a hard terminal user on Linux, given my involvement with the more lay audience, I often avoid using it to be able to feel in my skin what are the difficulties, doubts and problems that users may have and thus be able to build some of the blog articles, but I confess that I am interested in the subject and it is always good to know new tools.
More than a month ago I was talking to my good friend Gabriel, from the channel Tux’s Toca, about alternative interpreters to Bash, as he is doing a series on his channel entitled “Beyond GNU“, Which is very interesting by the way, where he shows that although Linux and GNU are commonly related, one manages to exist without the other, and then he gave me a“ formal ”presentation of ZSH, a shell with several interesting features for power users and that he has used professionally for a long time.
Some time ago I made a video comparing a feature that caught my attention within ZSH, check it out below:
As I did not find any tutorial very well explained on the subject, today I will show you how you can change the default shell of your system without much complication, in this case we will make the switch to ZSH, but the procedure is for any other you like it more, just know the path of his torque.
Installing ZSH and replacing Bash as the default Shell
ZSH is already available in the repository of most Linux distributions, so it’s easy to install, but if you wanted to do it manually, there’s also his GitHub page, there you can find information about a project called “Oh My ZSH!” that will boost your ZSH even more, in case you wanted to extract even more of the tool’s potential.
In Ubuntu the terminal installation process looks like this:
sudo apt install zsh
It’s just that, easy right?
Well, once you open the terminal, you will probably still be using Bash, to start using ZSH inside the same terminal just type:
Notice how the terminal changed its look, instead of you having the popular “$” indicating your common user, you now have a percentage symbol. In the case of using root, both Bash and ZSH will display the traditional “#”.
Okay, so for you to use ZSH just type «zsh» inside Bash, but what if you want the terminal emulator to open with ZSH as default, «how do you do»?
Simple too, let’s use the terminal again, we need to edit the file passwd inside this directory:
For this you can use a text editor of your choice, gedit, kate, vim, nano, etc, etc., so choose the one you like best and let’s go ahead. For example, using gedit:
sudo gedit /etc/passwd
Look for your user’s line, it should be at the end of the file, in my case on line 40, but yours may be on another one, so look calmly.
Note that there is information right at the end of the line ”: / bin / bash“, All we have to do here is change the word“bash» per «zsh“.
After making the change, save the document. You will need to log out of your system and log in again, if you prefer, you can restart too, but this is probably not really necessary.
When you log in again and open the terminal you will already be using ZSH, to revert the configuration back to Bash just repeat this tutorial and change the configuration file back to «bash» at the end instead of «zsh». Alternatively, in the same way you did before to test ZSH while Bash was the default, just type «bash» inside the terminal with the ZSH and Bash quickly returns to appear.
To the next!