contador web Saltar al contenido

From Bash to ZSH – How to Change the Default Terminal on Linux

As much as this is something most users do not care about, it is good to know that the Bash, Although it is the default and most popular command interpreter, it is not the only alternative you have, by the way, there are some other very interesting ones, like ZSH, that you will learn to configure today. Replacing bash with ZSH

I am not a bad terminal user on Linux, given my involvement with the more lay public, I often avoid using it to be able to feel on the skin what are the difficulties, doubts and problems that users may have and so can build some blog articles, but I confess that I'm interested in the subject and always good to know new tools.

More than a month ago I was talking to my great friend Gabriel from the channel Tux's lair, about alternative performers to Bash, as he's doing a series on his channel titled "Far beyond GNU"which is very interesting by the way, where he shows that while Linux and GNU are commonly related, one can exist without the other, and then he gave me a" formal "presentation of ZSH, a shell with several interesting features for power users And he has been using it professionally for a long time.

Some time ago I made a video comparing a feature that caught my attention inside ZSH, check 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 case we will change to ZSH, but the procedure is for any other you like it more, just know his binary path.

Installing ZSH and Replacing Bash as Default Shell

ZSH is already available in most Linux distributions repository, so it's easy to install, but if you wanted to do it manually, there is also his GitHub page, There you find information about a project called "Oh My ZSH!" which will further boost your ZSH if you wanted to extract even more from the tool's potential.

On Ubuntu the terminal installation process looks like this:

sudo apt install zsh

That's right, easy isn't it?

Well, once you open the terminal, you are probably still using Bash, to switch to ZSH inside the same terminal just type:

zsh

Zsh Ubuntu Notice how the terminal has changed its look, instead of having the popular "$" indicating its common user, you now have a percentage symbol. If you use root, both Bash and ZSH will display the traditional "#".

Ok, so for you to use ZSH just type "zsh" into Bash, but what if you want the terminal emulator to open with ZSH as default, "how does"?

Simple too, let's use the terminal again, we need to edit the file passwd which is inside this directory:

/ etc / passwd

For this you can use a text editor of your choice, gedit, kate, vim, nano, etc, etc., so choose what you like best and let's go ahead. For example, using gedit:

sudo gedit / etc / passwd

standard terminal gedit

Look for the line of your user, it should be at the end of the file, in my case at line 40, but yours might be in another, so look calmly.

Note that there is information at the end of the line ": / bin / bash"all we have to do here is change the word"bash" per "zsh"

Configuring 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 reboot as well, but this is probably not really necessary.

When you log in again and open the terminal you are already using ZSH, to revert the configuration back to Bash just repeat this tutorial and change the configuration file back to "bash" instead of "zsh". Alternatively, just as you did before to test ZSH while Bash was the default, just type "bash" into the terminal with ZSH and Bash will pop back up.

See you next time!

_____________________________________________________________________________ See any errors or would you like to add any suggestions to this article? Collaborate, click here.

Rate this post