Sequence Zero

How I gave my Linux terminal a makeover

The shell terminal that you normally use in Linux is quite boring and lacks many functionalities that you expect from a place where (if you are a developer) you get things done. So the shell or bash, whatever you call it has very limited functionalities, and the most you can do is change the color of the text and background. If you install bat, you can highlight the syntax of your commands, but that's about it.

So I went out on my quest to give my terminal a makeover, and boy, upon searching, the sheer number of choices overwhelmed me. Each one came in different varieties with different setups, and I learned there are typically three main methods of doing it, all involving changing your shell configurations to a different shell: 1. zsh shell 2. fish shell 3. oh-my-bash

I used the zsh shell because of its massive support for plugins and also because the zsh shell is installed by default in macOS, so at least I could trust this method. There were so many tutorials out there, but one caught my eye in a funny way because it touted or claimed to give a "zen experience." In this YouTube video, the method that was demonstrated was on a different Linux distro. So for all my Ubuntu friends, I have tried to implement the changes similar to those in the video. For the errors that popped up, I either used Google or ChatGPT for troubleshooting.

Step 1: Install zsh

First of all, you have to install zsh if you don't have it installed on your PC. Check if it's already there:

zsh --version

If not, install it through your package manager:

# Ubuntu/Debian
sudo apt update && sudo apt install zsh

# Fedora  
sudo dnf install zsh

# Arch Linux
sudo pacman -S zsh

You have to change your shell after doing this by using the following command:

chsh -s $(which zsh)

Note: Make sure that you have git configured on your PC. For this, you can follow any tutorial available, but this tutorial by Odin Project is quite simple to follow.

Step 2: Install the tools you'll need

You'll need some modern tools to make this work properly:

Install eza (better ls command):

# Ubuntu/Debian
sudo apt install eza

# Or if that doesn't work, use cargo
cargo install eza

Install bat (better cat with syntax highlighting):

# Ubuntu/Debian  
sudo apt install bat

# Note: sometimes it's called batcat instead of bat

Step 3: Set up your configuration

Now you have to backup and create a .zshrc file and open it in your favorite text editor like VS Code or vim by using the following command:

# Backup existing config if you have one
cp ~/.zshrc ~/.zshrc.backup 2>/dev/null || true

# Open in VS Code
code ~/.zshrc

# Or use nano if you prefer
nano ~/.zshrc

It should open your text editor, and then if you want the theme similar to what I got, you have to copy the configuration I'm sharing below.

FZF in my case didn't work out, I constantly ran into errors, so I left it out. In my case, after following all the instructions, I gave my configurations a makeover using ChatGPT. You have to be precise about what you want here and then modify the .zshrc file. In my case, I had to make it look clean and functional while maintaining all the functionality.

Here's the complete configuration that worked for me:

# ============================================================================
# MINIMALIST ZSH CONFIGURATION
# ============================================================================

# Powerlevel10k instant prompt (keep for performance)
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

# ============================================================================
# ZINIT SETUP
# ============================================================================
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[[ ! -d ${ZINIT_HOME} ]] && {
  mkdir -p "$(dirname "${ZINIT_HOME}")"
  git clone https://github.com/zdharma-continuum/zinit.git "${ZINIT_HOME}"
}
source "${ZINIT_HOME}/zinit.zsh"

# ============================================================================
# ESSENTIAL PLUGINS
# ============================================================================
zinit ice depth=1; zinit light romkatv/powerlevel10k
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions

# Initialize completions
autoload -U compinit && compinit

# ============================================================================
# TERMINAL SETTINGS
# ============================================================================
export TERM="xterm-256color"
export COLORTERM="truecolor"

# ============================================================================
# HISTORY CONFIGURATION
# ============================================================================
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history
setopt HIST_VERIFY
setopt SHARE_HISTORY
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE

# ============================================================================
# KEY BINDINGS
# ============================================================================
bindkey -e                                    # Emacs mode
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
bindkey '^r' history-incremental-search-backward

# ============================================================================
# COMPLETION SETTINGS
# ============================================================================
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu select
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '[%d]'

# ============================================================================
# CLEAN ALIASES
# ============================================================================
# Core utilities
alias l='eza --icons -1'
alias ls='eza --icons --group-directories-first'
alias ll='eza --icons -la --group-directories-first'
alias la='eza --icons -a --group-directories-first'
alias tree='eza --tree --icons'

# Navigation
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'

# Safety nets
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'

# Modern alternatives
if command -v bat >/dev/null; then
  alias cat='bat --paging=never --plain'
  alias ccat='bat --paging=never --style=numbers'
fi

alias grep='grep --color=auto'
alias ip='ip --color=auto'

# ============================================================================
# ENVIRONMENT VARIABLES
# ============================================================================
export EDITOR="nano"
export PAGER="less"
export LESS="-R"

# ============================================================================
# SYNTAX HIGHLIGHTING (MINIMAL)
# ============================================================================
typeset -A ZSH_HIGHLIGHT_STYLES
ZSH_HIGHLIGHT_STYLES[command]='fg=green'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[path]='fg=blue'
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta'
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red'

# ============================================================================
# AUTOSUGGESTION SETTINGS
# ============================================================================
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=240'
ZSH_AUTOSUGGEST_STRATEGY=(history completion)

# ============================================================================
# POWERLEVEL10K CONFIGURATION
# ============================================================================
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# ============================================================================
# FUNCTIONS
# ============================================================================
# Quick directory creation and navigation
mkcd() { mkdir -p "$1" && cd "$1"; }

# Quick file search
ff() { find . -name "*$1*" -type f 2>/dev/null; }

# Quick directory search
fd() { find . -name "*$1*" -type d 2>/dev/null; }

# Git shortcuts (if you use git)
alias g='git'
alias gs='git status -s'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gl='git pull'

# ============================================================================
# PERFORMANCE OPTIMIZATIONS
# ============================================================================
# Skip global compinit for faster startup
skip_global_compinit=1

# Lazy load nvm, rbenv, pyenv etc if you use them
# Example: alias nvm='unalias nvm; source ~/.nvm/nvm.sh; nvm'

Step 4: Apply the changes

After saving the file, reload your configuration:

source ~/.zshrc

The first time you run this, it'll download all the plugins automatically. You'll also get a Powerlevel10k configuration wizard that'll help you set up your prompt exactly how you want it.

What you get after all this

Once you're done with this setup, your terminal will have:

If things go wrong

If bat doesn't work: Some systems call it batcat instead of bat. You can fix this:

sudo ln -s /usr/bin/batcat /usr/bin/bat

If eza isn't available: Just comment out those aliases and stick with regular ls.

If your fonts look weird: You might need to install a Nerd Font for the icons to display properly.

That's pretty much it. My terminal went from being a basic black screen to something that actually looks decent and works better. Took a few hours to set up (thanks to all the random errors I hit), but now I actually enjoy using the terminal instead of just tolerating it.