Step 1: Ditch Bash and Use ZSH + Oh-My-ZSH
- Bash (stands for Bourne Again Shell)
- ZSH (Z-Shell)
- C-Shell
- Fish
- etc etc
They all work a little differently or support different features. ZSH is super easy to customize though which is why we’ll be using it. If you have a mac you can brew install zsh
or for Linux sudo apt-get install zsh
Now all you need to do is set it as your default shell with this command chsh -s zsh
. chsh
stands for, you guessed it change the shell, -s tells the command that you want to change it to a specific shell which you pass in as an argument which here is zsh. You’ll be asked for your computer password too.
Step 2: Install Oh-My-ZSH
Install instructions here: https://github.com/robbyrussell/oh-my-zsh#via-curl
Congrats, Two steps done!! See how easy this is.
Step 3: Getting the Right Fonts
You’ll want to check out this repo: https://github.com/ryanoasis/nerd-fonts#font-installation which contains a ton of fonts that support all the awesome, cool symbols you’ll want to use. It a lot of fonts to install so be sure you don’t run this while your connectivity might drop or if you’re in a rush.
Nerdfont fonts support font-awesome glyphs, material design icons, options and more.
If you just want to get one, this is the font I’m using, and it worked great. Just click the link, download the TTF file and install the font on your computer. If you see the box with a question mark in it a time, it means the font you are using in your terminal doesn’t support that character.
Step 4: Themes and Colors
You have two things to focus on when customizing your terminal. The first is the theme. This is the way the terminal is going to look. The second is the colors of those things. This determines what shade of blue is your blue, what red is your red etc.
First, let’s talk about themes. To get started take a look at https://github.com/robbyrussell/oh-my-zsh/wiki/themes
All of these are baked into oh-my-zsh and all you have to do is edit your .zshrc file (its located at ~/.zshrc) and set ZSH_THEME="THEME_NAME"
, so ZSH_THEME="agnoster"
for example, and that’s it.
As for colors, you can take a look at this repo which has a bunch of nice color schemes ready to download for iTerm2. The colors can be edited in the settings. Go to settings > profiles > colors. In the bottom right corner is the color presets list. Click this and you’ll see an option to import a color scheme or select some built-in ones. Import any of the color schemes you download from that repo.
Step 5: Powerlevel 9K
Another awesome repo I recently found is PowerLevel 9K. It serves the same purpose as the themes in oh-my-zsh.
To install PowerLevel 9k check here for instructions
And then check out this page to see all the cool stuff other people have built. Find one you like and copy their settings into your .zshrc
file and then you can modify bits and pieces until it’s just how you like. I’d do this first before you try and build your own from scratch. Your mileage may vary with some of them. But once you find one you like you can modify any of the variables until it’s just how you like it.
(Some of the configs might include POWERLEVEL9K_MODE="SOMETHING_HERE"
and ZSH_THEME="powerlevel9k/powerlevel9k"
. If you already have them in your .zshrc
delete the duplicate and if you’re setting the first option make sure its set before ZSH_THEME
is.)
Step 6: Writing Your Own Functions
Powerlevel 9K supports a lot out of the box including GitHub status/other version control systems, current working directory, host, node version, time/date, and tons more.
You can also write your own functions to display more stuff. Below is the function I have to show if I’m connected to the internet. If so I display the symbol in green. Otherwise in red. You can write any bash function and have it echo
a statement at the end. Than to include it in the prompt add custom_internet_signal
(or whatever your function is called) and whatever the function echo
’s will appear!
Note: this function is stored in .zshrc
.
Note 2: \uXXXX
is saying display this Unicode character. To actually know what character that is google u+XXXX unicode character
.
https://medium.com/media/62fc4d3b34b66684387f41769f16f879
You can write functions to show your battery level (different icons for different statuses, different colors for different levels etc). The song playing on Spotify etc (this might take some work but check out https://github.com/hnarayanan/shpotify or https://github.com/johnelse/spotify-cli), Docker status etc.
And that’s it! 6 steps to trick out your terminal!