I recently changed my computer, so I had to configure back my entire work environment and I noticed that my terminal is what i barely pimped the most. Since I never made a post on the Dev Community I saw on it a great opportunity to share with you some tips about this terminal that scares so many young developer like me!
I’m on Mac, so my terminal is by default a zsh shell (since Catalina). A shell is a command-line interpreter and there different ones for different computer operating system, for the sample, on Linux, it’s commonly a Bash shell. So if you use Linux or Windows, the procedure and the commands may be different.
FYI: You can know your shell by running this command:
$ echo $0
First of all we need a package manager to be able to install and maintain free and open-source software as Node.JS, Python, … For that we’ll use cUrl, a tool to get some data from or to a server, so a url. For making that append we’ll run this command on our terminal:
$ curl -fsSL -o install.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
If you want know more about the flags used in this command line. i recommend to you to visit the awesome explainshell.com!
It’s time to make our terminal more pretty, with some colors for sample! We’ll install Oh My Zsh, a delightful open source framework for zsh shell that modernises the terminal and makes easy the configuration of it.
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
It’s now the time to configure it, and it’s really easy! Open the configuration file created by the previous installation:
$ vim ~/.zshrc
In this configuration file you will find among others a variable “ZSH_THEME”, it determines the theme you will apply to your terminal. There is a lot of them available, and a small google search will allow you to see them all, for my part, the agnoster theme is my favorite. So, in my .zshrc file I’ve ZSH_THEME=“agnoster”.
But for this particular theme we need a particular font, the Ubuntu Mono. Of course you can download this font as a standard human or again use your terminal by directly clonning the project:
git clone https://github.com/powerline/fonts.git
Going to the created folder and run the script for the installation
cd fonts && ./install.sh
And finally, deleting the folder
cd .. && rm -rf fonts
Now that you have these awesome fonts, let’s use them in the terminal! For this, in the menu bar, follow Terminal > Preferences and search “font” in the first panel. Click on the "change" button and select “Ubuntu Mono derivative Powerline 11”. Close the windows and make the changing operate by telling to the terminal that we have changing something in the zshrc file:
$ source ~/.zshrc
You can also choose different colors for the background, the sections lines ect... in the previous preference menu!
Follow me to be informed of the next article about aliases in the terminal!