Configuring zsh
First, we will change the default shell of the terminal to zsh. ZSH is a highly configurable and powerful shell. It is the default shell on kali Linux after 2020.4, but it can be downloaded and set to default in almost every OS.
Installing zsh
Check if zsh is installed in your system.
cat /etc/shells
If not, install using the following commands:
- Debian
sudo apt install zsh
- Mac
brew install zsh
- Arch & Manjaro
pacman -S zsh
- Fedora
dnf install zsh
Once installed, set zsh as the default shell.
chsh -s $(which zsh)
Log out and check if your current shell is zsh.
echo $SHELL
Installing oh-my-zsh
Install oh-my-zsh with the following script:
Configure Theme
By default, oh-my-zsh uses a theme called "robbyrussell". You can simply change the theme to your liking by editing the .zshrc
config file. Simply replace the value of the ZSH_THEME
variable to your liking. You can get the list of themes from here.
In this tutorial, we will go with a popular theme called powerlevel10k.
First, install the required fonts from here. You just need to double-click the downloaded fonts to install them. Once installed, change the font of the terminal to MesloLGS NF.
Now clone the repository of powerlevel10k inside the themes folder.
cd ~/.oh-my-zsh/custom/themes
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git
Update the ZSH_THEME
variable inside the ~/.zshrc
to following
ZSH_THEME="powerlevel10k/powerlevel10k"
Now, you can simply run source ~/.zshrc
and go through the configuration wizard to set up the style you prefer.
You can reconfigure it anytime by running p10k configure
.
Installing tmux Themes
We will need to install some plugins before we are done setting up tmux. We will need tpm to handle those plugins.
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
Edit the tmux configuration file (~/.tmux.conf
) we created previously, and add the following line at the bottom of the file.
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Press Prefix + r to apply changes to the current session without closing tmux (check Part 1 if you have not configured this portion).
Now you can install themes using tpm. Just add the following lines on .tmux.conf
## For Dracula Theme
set -g @plugin 'dracula/tmux'
## For Nord theme
set -g @plugin "arcticicestudio/nord-tmux"
## For tmux-power
set -g @plugin 'wfxr/tmux-power'
Once you are done adding any one of the themes above, press Prefix + I to install it. Then press Prefix + r to apply the changes to the current session.
This is what my tmux looks like currently. I am using the Dracula theme.
Installing Plugins
You can also install many plugins (for zsh and tmux) to help maximize your productivity. Some of them are:
Zsh Autosuggestions
Suggests commands as you type based on history in a faded grey colour
Installation
Clone the repo with:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Then add the plugin to the list of plugins on ~/.zshrc
Zsh Syntax Highlighting
Highlights commands while they are being typed. Helps to catch syntax errors.
Installation
Clone the repo with:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Then activate the plugin in ~/.zshrc
Tmux Resurrect
Restore the tmux environment after system restart
Installation
set -g @plugin 'tmux-plugins/tmux-resurrect'
Tmux Logging
Logs all the output in the current pane. Has a screen capture feature that saves all the visible text in the current pane to a text file.
Installation
set -g @plugin 'tmux-plugins/tmux-logging'
There are tons of plugins available according to your needs, and new plugins are released constantly as there is a huge dedicated community, so feel free to explore and find the one you like the most.
Thank you for reading, see you in the next one!