This tutorial will teach you the basics of terminal customization. I hope you can tag along so you can start customizing your terminal too. On a side note though: this post assumes you’re either using macOS or Linux. Additionally, I assume you have Git and Vim installed, and that you’re using a package manager such as Homebrew.
The Z Shell
In order to start making changes to the terminal, it's necessary to download and install a UNIX shell. More specifically, the UNIX shell we're using is a refined bundle of tools that allows us to make use of the terminal in a more specific way. Think of it as an improved version of the command line. In this case, we’re using Zsh, also known as The Z Shell, an open-source UNIX shell that has been used by thousands of users and also happens to be open-source. Refer to this piece of documentation on GitHub written by Robby Russel for a well-written in-depth guide on how to install Zsh.
It's always a good idea to execute the -- version command once the installation is complete. This helps us make sure the installation went through successfully. It should look like this:
Once you execute -- version, the output message should be similar to this:
Oh My Zsh
To make things even better, we’re also installing a framework manager that will help us, well, manage the configurations we judge necessary in the future. While Zsh is what allows us to start tweaking the terminal, Oh My Zsh is where the magic happens. It comes with more than 100 plugins and themes available which is more than enough customization for users like me. Because I have friends that love creating their own plugins and themes, it is also worth noting that Oh My Zsh is open-source. So, rest assured: if you happen not to find what you’re looking for in their catalog, you can certainly build it yourself!
I recommend installing it using cURL:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
However, you can also run Wget as opposed to cURL:
During either of those two installation processes, you might get prompted with something like this:
To which you simply press y and hit enter.
At this point, any changes that you’d like to take effect on the terminal window you're using should be made on the ~/.zshrc file and not to ~/.bash-profile.
Useful Plugins with Zplugin
Because this is an introductory post, we’ll keep things simple. As such, we need to install Zplugin which brings useful tools such as command suggestions, auto-completion, and syntax-highlighting.
Execute the following via cURL:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zplugin/master/doc/install.sh)"
Once the installation is complete, the output message should be similar to this:
Now, for this next step, we will be using Vim. If you don't have much experience with Vim, it's highly recommended that you practice a bit before continuing. The reason being, it’s not hard to mess something up while using it if you don’t know what you’re doing.
Open ~/.zshrc using Vim:
At the end of the file, find the line that reads “###End of Zplugin installer’s chunk” and add the following:
Since we’re using Vim, once those three lines are added, simply press ESC, and :wq.
Done! You now have command suggestions, auto-completion, and syntax-highlighting.
Installing Your First Theme
Before you start the installation process though, you might need to go through an extra step. That is if you’re using macOS. To agree with Xcode's license agreements, execute the following:
Once you have agreed to Xcode's license agreements, it’s time to clone the Dracula theme into Oh My Zsh’s folder:
Now, let’s edit ~/.zshrc once again using Vim, and set it Dracula:
Once everything is fully installed, I recommend restarting your machine so that we can make sure the CPU is refreshed and that the changes we made throughout this tutorial can take effect. As a software developer myself, I sure spend a considerable amount of time using the terminal. Tailoring it to my needs only makes sense - and you should, too!