The linux terminal is very useful but for me it is sometimes very annoying in some aspects, so for years I have been using ZSH with some plugins and a theme that I think is much more productive, I decided to create this post for those who want to use this same configuration or If you are inspired by her to create your own feel free, the final result will be this:
Installing ZSH
To start, let’s install zsh, which is a command interpreter just like bash but will allow us to customize more and easier.
Let’s install, according to your linux distribution:
Ubuntu:
apt install zsh
Fedora:
dnf install zsh
Arch:
pacman -S zsh zsh-completions
Installing Oh My Zsh
Oh My Zsh is what does the magic, it is a tool to manage zsh settings in a very easy way. Just install with:
curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh; zsh
If this message appears, we already have Oh My Zsh installed, but now we need to change the default shell to Zsh:
sudo usermod --shell $(which zsh) $USER
With that we have zsh as default but it’s no use closing and opening the terminal, for it to work you’ll have to logout and login to your user again.
With that we already have a much better terminal at hand, try typing some command like ls
and giving TAB
a few times.
Plugins
For anything you can think of there is a plugin on Oh My Zsh, and it’s no joke, gives a look at the list .
You can test and activate the plugins according to your needs, but here we will activate the following ones:
zsh-syntax-highlighting
This plugin makes it green if the command is correct or red if there is an error. Let’s install it with:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
To enable it add zsh-syntax-highlighting
in plugins in the ~/.zshrc
file.
zsh-autosuggestions
It will suggest commands according to your history, just press the right arrow and it completes the command. Install with:
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
To enable it add zsh-autosuggestions
in plugins in the ~/.zshrc
file.
fzf
Fzf is a fuzzy finder, a file searcher directly from the terminal. Let’s install with:
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install
Answer y
to all questions.
Now you can press CTRL+T
to search files whenever you want.
And you can also do the same to search your command history with CTRL+R
.
Theme
Another wonderful thing that Oh My Zsh adds is several themes, you can choose any one, I like bira, it’s a simple theme but it gives me some information, as with the git plugin it’s already activated it shows the current branch, directory and user, which is enough for me.
To activate the theme add bira
(or another one of your choice) to ZSH_THEME
in the ~/.zshrc
file.
Just close the terminal and open it again to see your theme applied.
Much more can be done, such as aliases or using other plugins that you find interesting, this article is just a tip and serves to show the possibilities, don’t stop here and leave your terminal in the ideal way for you.