How to Customize Linux Terminal: Themes and Plugins

This guide shows you how to customize Linux terminal, step by step.

This guide covers installing and configuring tools and plugins for features like autocompletion, autosuggestions, syntax highlighting, command-line search, and better Git support.

Table of Contents

  1. Steps for Customizing the Linux Terminal
    1. Install Zsh
      • Installation Commands for Various Linux Distributions
    2. Install Oh My Zsh
      • Installation Methods: Curl and Wget
      • Prerequisites: Git, Curl, and Wget Installation
    3. Install Nerd Fonts
      • Steps for Downloading and Setting Nerd Fonts
    4. Set Up Powerlevel10k
      • Installation Command
      • Theme Configuration in ~/.zshrc
      • Running the Setup Wizard
    5. Install Zsh Plugins
      • Zsh-Autosuggestions
        • Plugin Installation and Configuration
      • Zsh-Syntax-Highlighting
        • Plugin Installation and Configuration
    6. Install diff-so-fancy
      • Installation Commands
      • Integration with Git Configuration
    7. Install bat
      • Installation Commands for Various Linux Distributions
      • Usage Example
    8. Install fzf
      • Installation Command
      • Key Bindings and Usage

1. Install Zsh

The Z shell (Zsh) is a powerful Unix shell with extensive plugin and theme support allowing users to customize their terminal.

Below are commands to install Z shell:

Debian/Ubuntu:

$> sudo apt install zsh

RedHat/CentOS:

$> sudo yum install zsh

Arch/Manjaro:

$> sudo pacman -S zsh

Fedora:

$> sudo dnf install zsh

OpenSUSE:

$> sudo zypper install zsh
How to Customize Linux Terminal: Themes and Plugins

2. Install Oh My Zsh

Oh My Zsh is a community-driven framework for managing Zsh configuration, and providing plugins, themes, and utilities. Below are methods to install Oh My Zsh:

Using curl:

$> sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
How to Customize Linux Terminal: Themes and Plugins – step 2

Using wget:

$> sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
How to Customize Linux Terminal: Themes and Plugins – step 3

Make sure you have git and curl or wget installed on the system for the commands to work. To install use command below:

$> sudo apt install git

$> sudo apt install curl

$> sudo apt install wget

3. Install Nerd Fonts

Nerd Fonts are patched fonts with additional glyphs and icons. These are essential for themes like Powerlevel10k providing better visual appeal to the user.

Steps for Installation:

1. Download the Hack Font or any Nerd Font from their website.

2. Install the font by double-clicking the `.ttf` file.

3. Set the font as the default in your terminal settings.


4. Set Up Powerlevel10k

Powerlevel10k is a fast, flexible Zsh theme that enhances command-line aesthetics.

For Installation use command below:

$> git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
How to Customize Linux Terminal: Themes and Plugins – step 4

Steps for Configuration:

1. Set the theme in ~/.zshrc, here we are using nano text editor for demonstration:

$> sudo nano ~/.zshrc
   ZSH_THEME="powerlevel10k/powerlevel10k"
How to Customize Linux Terminal: Themes and Plugins – step 5

2. Apply changes:

   $> source ~/.zshrc

3. Run the setup wizard if not auto-started:

   $> p10k configure
How to Customize Linux Terminal: Themes and Plugins – step 6

5. Install Zsh Plugins

1. Zsh-Autosuggestions

Zsh-Autosuggestions is a Zsh Plugin that provides real-time command suggestions as you type.

1. Use the command below to download the plugin:

$> git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
How to Customize Linux Terminal: Themes and Plugins – step 7

2. Add zsh-autosuggestions to the plugins array in ~/.zshrc, here we are using nano text editor for demonstration:

$> sudo nano ~/.zshrc
plugins=(... zsh-autosuggestions)
How to Customize Linux Terminal: Themes and Plugins – step 8

3. Apply changes:

$> source ~/.zshrc
2. Zsh-Syntax-Highlighting

Zsh-Syntax-Highlighting is a Zsh Plugin that adds syntax highlighting for commands as you type.

1. Use the command below to download the plugin:

$> git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
How to Customize Linux Terminal: Themes and Plugins – step 9

2. Add zsh-syntax-highlighting to the plugins array in ~/.zshrc, here we are using nano text editor for demonstration:

$> sudo nano  ~/.zshrc
plugins=(... zsh-syntax-highlighting)
How to Customize Linux Terminal: Themes and Plugins – step 10

3. Apply changes:

$> source ~/.zshrc

6. Install diff-so-fancy

Diff-so-fancy improves the readability of Git diffs on a Linux Terminal.

Installation:

$> sudo apt install nodejs npm
$> npm i -g diff-so-fancy
How to Customize Linux Terminal: Themes and Plugins – step 11

To integrate diff-so-fancy with git use the commands below:

$> git config --global core.pager "diff-so-fancy | less --tabs=4 -RFX"

$> git config --global interactive.diffFilter "diff-so-fancy --patch"

$> git config --global color.ui true
How to Customize Linux Terminal: Themes and Plugins – step 12

Use diff-so-fancy as below:

$> git diff

7. Install bat

Bat is a modern replacement for cat with syntax highlighting and Git integration.

Use the Installation Commands below:

Debian/Ubuntu:

$> sudo apt install bat

RedHat/CentOS:

$> sudo yum install bat

Arch/Manjaro:

$> sudo pacman -S bat

Fedora:

$> sudo dnf install bat

OpenSUSE:

$> sudo zypper install bat
How to Customize Linux Terminal: Themes and Plugins – step 13

Use the bat command as below:

$> batcat <file>
How to Customize Linux Terminal: Themes and Plugins – step 14

8. Install fzf

fzf is a command-line fuzzy finder for files, commands, and more.

Use the command below for Installation:

$> git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf

$> ~/.fzf/install
How to Customize Linux Terminal: Themes and Plugins – step 15

Key Bindings:

– Ctrl + T: Browse the file system.

– Ctrl + R: Search command history.

How to Customize Linux Terminal: Themes and Plugins – step 16

Related Guides