In this tutorial, you will discover how to amp up your terminal by using the ZSH and oh-my-zsh framework.
Z Shell or ZSH is one of the most powerful interactive login shell for Linux and Unix-based systems. It's built on bash and provides extended features over it. It also provides the ZSH scripting language which is closely similar to bash.
If you spend a lot of time on your terminal, you will know the need to quick and convenient features that makes your life easy. Luckily, zsh provides both of the above while providing a minimal learning curve.
Let's dive in.
Installing ZSH and git
Although zsh is default in latest versions of macOS, most Linux distributions still ship bash as the default shell.
Hence before using oh-my-zsh framework, its good to ensure you have ZSH installed.
On Debian and Debian-based distributions, we can run the command:
sudo apt-get upate && sudo apt-get install zsh git
sudo yum install zsh git
sudo pacman -S zsh git
sudo zypper install zsh git
Once installed, you can change the default shell to ZSH with the command:
Change default shell to ZSH
You can change the default shell to zsh with the command:
chsh -s /bin/zsh
Installing oh-my-zsh framework
oh-my-zsh is a free and open-source framework for zsh shell. It comes packed with features and customisations using the the native zsh fi configuration file.
oh-my-zsh also allows you to add plugins for support for various operations such as version control, node.js, python, and more.
Before you can use oh-my-zsh on your system, run the commands below to install it:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
The commands above will clone and install the oh-my-zsh framework on your system.
Setting Custom Theme
By default, oh-my-zsh will use a theme called
robbyrussel after the creator of oh-my-zsh.
To set a different theme, navigate into the resource below:
Choose the theme you wish to apply and note down its name.
Next, edit the oh-my-zsh configuration file:
ZSH_THEME entry and replace the value with the name of the theme you selected.
For example, if you selected the theme
Save and close the file.
To apply the changes, use the
Installing oh-my-zsh plugins
You can also install a custom plugin which comes with its own set of features for that tool. To locate the plugin you wish to use, navigate into the resource below:
For example, to add the python plugin,
.zshrc file and add the plugin as shown:
The entry above enables the
You can then use the
source command to reload the changes.
Ensure to read the instructions and the supported commands for your plugin.
In this article, you learned how you can customize your terminal using ZSH and oh-my-zsh framework. Feel free to explore the docs for more.
Share with your friends and leave a comment below.