Make Pretty Terminal!

So you just started getting busy with Linux. 2 things:

Congrats & FI-NAL-LY!

Welcome to the world of ASCII, endless typing and unforgivable mistakes! The road to grasping this ancient OS is a treacherous yet wonderful one, paved with mysteries and easter eggs that continuously amaze even the most hardened and decorated digital veterans out there.

The learning curve is steep, but fear not! We are here to ease you into it and it all starts with the ultimate tool: Your Terminal, this magical black box of endless possibilities, a tool that – once accustomed to – becomes indispensable: from setting up servers, networks and websites to checking your cryptocurrency balances and note-taking apps, you can do it all!

And it all starts when you enjoy looking at it.

So let’s make pretty!


The first time you open a Terminal window, you are greeted with white text on blackness (or black on white. In any case, it’s the monochromatic stuff of nightmares). It’s raw, unwelcoming, it looks daunting and scary. In all honesty, it pushes you away:

To stay engaged in the Terminal, it’s a good idea to spice it up a little bit. To do so, I like to use a shell called ZSH, coupled with a plugin named oh-my-zsh and a theme named powerlevel10k.

ZSH, also called the Z shell, is an extended version of the Bourne Shell (sh), with plenty of new features, and support for plugins and themes. Since it’s based on the same shell as Bash (the default shell), ZSH has many of the same features, and switching over is a breeze.

Oh-My-Zsh is the most popular plugin framework for ZSH, and it comes with many built-in plugins and themes as well. 

Powerlevel9k is a theme for ZSH which uses Powerline Fonts. It can be used with vanilla ZSH or ZSH frameworks such as Oh-My-Zsh.

So let’s install these in the above-mentioned order.

Note: copy the entire commands below; even if you see them on 2 lines, they are one command each.

Install ZSH:

If you’re on a Mac, the easiest way is by using Homebrew. If you don’t have Homebrew installed, copy and paste the following in Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

This will install Homebrew. Easy huh? Now let’s install ZSH:

brew install zsh

That’s it, ZSH installed! Now let’s make sure to set it as the default shell:

chsh -s /bin/zsh

If you’re on a Linux distribution, use the following:

For Ubuntu, Debian & derivatives (including Windows 10 WSL):

sudo apt install zsh

For Centos/RHEL:

sudo yum install zsh

Now let’s install oh-my-zsh:

The following can be installed from either Mac, Ubuntu, Centos and even Windows 10 WSL. You can choose either command:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

OR

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Finally, let’s install Powerlevel10k:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

Once installed, edit your ~/.zshrc file and simply change the theme (by default “robbyrussell”) to “powerlevel10k/powerlevel10k”:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
 

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/apexlemons/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"                                              <----- THIS LINE  

Save and exit out of your file and either restart terminal or type source ~/.zshrc

You will be presented with a bunch of options to set up your environment. Experiment with it and see what best fits your style. You can always use p10k configure should you decide to change it.

Enjoy!

Leave a Comment