7 privacy settings that you have to activate according to the experts

how to change your shell from Bash to Zsh (and install 'Oh My Zsh!' to customize it)

When we work from a Linux terminal window (or * BSD, or WSL, etc), we are actually working with two types of software: the terminal emulator (Xterm, Konsole, Windows Terminal, etc) and the command interpreter (or 'shell'): the program responsible for converting the text we type into instructions.

By default, in most Linux distributions, including the different options available from WSL2, the command interpreter that we will find will be the popular and reliable bash.

A look at Zsh

However, an alternative to Bash called Z Shell or Zsh gains more popularity (In fact, the latest versions of macOS already include it by default).

Zsh is broadly compatible with Bash, but more customizable, and with particularities both in the way we interact with the shell, and in the syntax of the scripts. Let's review the advantages of using Zsh:

  • Lets you link file extensions with a program: The existence of suffix aliases allows that, after creating it ("alias -s txt =" vim ""), each time we type the name of a text file in the terminal, the associated program is automatically opened (in this case, Vim ).

Living life (almost) without a graphical interface: this is how Linux users who see everything within a console in text mode work

  • Globbing: The use of wildcard characters for file names. In this way, if we type something like "vim / u / l / b / d" and press the tab, it would automatically become the command "vim /usr/local/bin/destroy.sh"

  • Smart navigation: Do you want to change directory using 'cd'? Well, write the command, hit the tab and choose which one you want to go to. Or better: just type a part of the name of the directory you want to go to, and Zsh will identify which one you mean.

  • Spell Check Commands: If we write "cd Superdirectory" where there is only one folder called "superdirectory", the program will know that we mean the first one.

  • Improved command history: Bash allows you to go back chronologically in the command history, but Zsh also allows you to start writing a command and navigate exclusively between those that match what has already been written.

Oh My Zsh!

But not everything ends with the installation of Zsh: this is only a first step that opens the door to new customization options. And that's where the useful and popular framework comes in Oh my Zsh!.

Oh My Zsh! has a wide and active community of users and developers They do not stop producing and improving all kinds of themes to improve the appearance of our terminal, and plugins to expand its functionalities.

So, for example, the plugin 'Git'automatically create multiple aliases to use this command, converting "git pull" to' gl 'or "git push" to' gp '; Meanwhile he 'Zsh-syntax-highlighting'colors correctly written commands green, and wrong ones red.

And if you are convinced that one marked in red should work, maybe you should install the plugin 'Command-not-found', to suggest which packages to install.

And if you are still not convinced, take a look at what your terminal will look like featuring some of the most popular Oh My Zsh! themes:

Screenshot 1

Theme 'Agnoster'.

Screenshot 2

Theme 'PowerLevel9K'.

How to install Zsh and Oh My Zsh!

First check which shell you are using at the moment. This is done by entering the following command in it:

ps -p $$

If the answer is not 'zsh', we will have to install it. That, in APT-based distributions, such as Debian, Ubuntu and their derivatives, is achieved with the following command:

sudo apt update && sudo apt install zsh

Next, we must tell the system that we want to use zsh as the default shell. So:

chsh -s $(which zsh)

And to install the framework? Easy, copy and paste the following:

sudo apt install git curl -y

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Once Oh My Zsh! Is installed, a hidden configuration file will be created in your user folder (~ / .zshrc). You just have to open it with your favorite text editor and, where it says'plugins =', put those that interest you in parentheses, like this:

plugins=(git zsh-syntax-highlighting command-not-found)

In that same file, we must edit the section 'ZSH_THEME =' to indicate the theme that we want to use.

Although, be careful: each theme may need a different previous step (such as the installation of a font), so you should check it in each case.