Home Making Linux Terminal Awesome
Post
Cancel

Making Linux Terminal Awesome

Making Linux Terminal Awesome

Zsh

The Z-shell or Zsh is an UNIX shell with support for various plugins and themes.

1
2
3
4
5
sudo apt install zsh      [ Debian/Ubuntu ]
sudo yum install zsh      [ RedHat/CentOS ]
sudo pacman -S zsh        [ Arch/Manjaro ]
sudo dnf install zsh      [ Fedora ]
sudo zypper install zsh   [ OpenSUSE ]

1

Oh My Zsh

Oh My Zsh is an open-source and community-driven framework for managing Zsh configuration. It comes bundled with thousands of helpful functions, plugins, themes, and much more.

Using curl

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

Using wget

1
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

2

Nerd Fonts

Nerd Fonts is a project to create patched fonts. Nerd Fonts takes popular programming fonts and patches them with a large number of glyphs (icons).

  • Download hack font
  • Install it by double clicking on the .tff file. You can also use any other font but make sure it supports all the icons and glyphs required by powerlevel10k.
  • Select Hack Font as the default font.

3

Powerlevel10k

Powerlevel10k is a theme for Zsh. It changes normal shell commands to colorful commands and emphasizes speed, flexibility, and out-of-the-box experience.

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

1

An installation prompt will begin by default, but if it doesn’t run.

1
p10k configure

Change the default theme to ZSH_THEME="powerlevel10k/powerlevel10k" inside ~/.zshrc.Commit the changes by running

1
source ~/.zshrc

2

zsh-autosuggestions

Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.

1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Add zsh-autocomplete to the list of plugins inside ~/.zshrc plugins=( [plugins...]).Commit the changes by running

1
source ~/.zshrc

3

zsh-syntaxhighlighting

zsh-syntax-highlighting provides syntax highlighting for the shell zsh. It enables highlighting commands whilst they are typed at a zsh prompt into an interactive terminal. This helps review commands before running them, particularly in catching syntax errors.

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Add zsh-syntax-highlighting to the list of plugins inside ~/.zshrc plugins=( [plugins...]).Commit the changes by running

1
source ~/.zshrc

4

diff-so-fancy

It is a tool that converts the output of diff utility into a more human-readable form. It improves the development speed by providing a simpler way to compare recent changes. With diff-so-fancy, one can focus on the code quality instead of figuring out what all the + and - mean?

1
npm i -g diff-so-fancy

4

Integrate diff-so-fancy with git.

1
2
3
4
5
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

Now, simply use the git diff command to view recent changes.

1
git diff

5

bat

bat is a supercharged version of the native cat command. It includes features like syntax highlighting, git integration, automatic paging, and much more.

1
2
3
4
5
sudo apt install bat      [ Debian/Ubuntu ]
sudo yum install bat      [ RedHat/CentOS ]
sudo pacman -S bat        [ Arch/Manjaro ]
sudo dnf install bat      [ Fedora ]
sudo zypper install bat   [Image Widget OpenSUSE ]

6

Viewing the content of a file with first cat and then with bat.

7 8

fzf

It’s an interactive Unix filter for command-line that can be used with any list; files, command history, processes, hostnames, bookmarks, git commits, etc.

1
2
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

5

Use ctrl + t to navigate through the file system. 6

Use ctrl + r to navigate through older commands. 7

If you use VS Code

Paste this into setting.json to render all the glyphs-icons in the integrated-terminal.

1
2
3
4
5
6
{
"terminal.integrated.fontFamily": "Hack Nerd Font",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.rendererType": "canvas",
"terminal.integrated.lineHeight": 1.3,
}

To use bash again

For a single session

1
bash

To make bash the default terminal

1
chsh -s $(which bash) 

I will also soon be publishing this article on GeeksforGeeks

This post is licensed under CC BY 4.0 by the author.

Installing MathJax & Latex Cheat Sheet

Markdown Cheat Sheet