Skip to main content

Supercharge Your Terminal ZSH

Zsh is a powerful shell that can completely transform your terminal experience with better customization, plugins, and themes. In this guide, we’ll set up Zsh with Oh My Zsh, install useful plugins, and configure a sleek prompt.


Step 1: Install Zsh

First, make sure your system is up to date and install zsh:

sudo apt-get update
sudo apt install zsh -y
Step 2: Make Zsh Your Default Shell

Change the default shell to Zsh and log out and back in:

chsh -s $(which zsh)

When prompted, choose option 0 for your user. After logging back in, you’ll be running Zsh.

Step 3: Install Essentials

Before moving forward, let’s ensure some basic tools are installed:

sudo apt-get install git curl vim -y
Step 4: Install Oh My Zsh

Run the official installer script to set up Oh My Zsh:

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

This will set up the framework that makes plugin and theme management super easy.

Step 5: Add Plugins

We’ll add two popular Zsh plugins:

  • zsh-syntax-highlighting → Colorizes commands as you type
  • zsh-autosuggestions → Suggests commands from your history

Clone them into your ~/.oh-my-zsh/custom/plugins folder:

Zsh-syntax-highlighting
git clone [email protected]:zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

Zsh-autosuggestions
git clone [email protected]:zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
Step 6: Customize Your .zshrc

file and configure it like this:

Open your ~/.zshrc
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# Choose a theme (try "avit" or "agnoster")
ZSH_THEME="avit"

# Enable plugins
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
history
dirhistory
colored-man-pages
jsontools
)

# Custom prompt tweaks
prompt_dir(){
prompt_segment blue $CURRENT_FG '%1~'
}

prompt_end() {
if [[ -n $CURRENT_BG ]]; then
print -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
else
print -n "%{%k%}"
fi

print -n "%{%f%}"
CURRENT_BG=''
# Adds the new line and ➜ as the start character.
printf "\n ➜";
}

# Show timestamps in history
HIST_STAMPS="yyyy-mm-dd"

# Load Oh My Zsh
source $ZSH/oh-my-zsh.sh
Step 7: Reload Your Shell

Apply changes by reloading your shell:

source ~/.zshrc