Better Terminal Experience¶

Introduction¶
I have been using terminal for a long time, it's one of my essential tools for my everyday work and hobbies.
The default terminal experience is not very user friendly, and I find it sometimes frustrating to use for basic tasks.
So I decided to improve my terminal experience for macOS and Linux without too much effort from the user side.
This guide will help you to install and configure the **better terminal experience in less than 5 minutes.
Better Terminal Experience guide based on ZSH Shell with Oh My Zsh on top of it.
Using built-in theme called Bira, zsh auto suggestions plugin that suggests commands as you type based on history and completions and zsh syntax highlighting plugin that highlighting of commands whilst they are typed at a zsh prompt into an interactive terminal.
What's ZSH¶
Z-shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a shell scripting command interpreter. Zsh is an enhanced Bourne shell with many enhancements, including some Bash, ksh and tcsh features.
What's Oh-My-Zsh¶
Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.
Installation¶
You can copy and paste the following code with nano <name_of_your_file>.sh
#!/bin/bash
# Install required packages
echo "Installing required packages..."
if [[ $(uname) == "Linux" ]]; then
sudo apt install -y git zsh wget
elif [[ $(uname) == "Darwin" ]]; then
brew install git zsh wget
fi
# Install Oh My Zsh
echo "Installing Oh My Zsh..."
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
# Change default shell to Zsh
read -p "Do you want to change the default shell to Zsh? (y/n)" -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
chsh -s $(which zsh)
fi
# Clone plugins
echo "Cloning plugins..."
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
# Configure Zsh
echo "Configuring Zsh..."
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="bira"/' ~/.zshrc
sed -i '/^plugins=(/c\plugins=(git colored-man-pages docker docker-compose iterm2 node npm brew colorize macos pip pyenv virtualenv adb aws command-not-found zsh-autosuggestions zsh-syntax-highlighting)' ~/.zshrc
cat <<EOT >> ~/.zshrc
## Fix for Slow zsh-autosuggestions copy&paste
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
zstyle ':bracketed-paste-magic' active-widgets '.self-*'
EOT
# Personal theme
read -p "Do you want to install a personal theme? (y/n)" -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Installing personal theme..."
wget -O ~/.oh-my-zsh/themes/3os.zsh-theme https://3os.org/assets/zsh/3os.zsh-theme
wget -O ~/.zshrc https://3os.org/assets/zsh/zshrc_config
fi
echo "Done! Please open a new terminal window to enjoy the Better Terminal Experience."
chmod +x <name_of_your_file>.sh Run the script ./<name_of_your_file>.sh Requirements¶
- git
- zsh
- wget
Install the following requirements packages with the following commands:
apt install -y git zsh wget
brew install git wget zsh
Oh My Zsh¶
We can proceed to install Oh My Zsh with the following command:
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
Answer Yes when asked to change the default shell to zsh.
Install Autosuggestions, Syntax-Highlighting Plugins using git clone:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
Configuration¶
Oh My Zsh crates a default configuration file called .zshrc in the user's home directory.
We need to edit the configuration file. You can use any editor to edit the file.
nano example:
nano ~/.zshrc
We need to add or change the following lines to the configuration file:
Find the theme and change it to bira
ZSH_THEME="bira"
find the plugins and change it to the following:
plugins=(git colored-man-pages docker docker-compose iterm2 node npm brew colorize macos pip pyenv virtualenv adb aws command-not-found zsh-autosuggestions zsh-syntax-highlighting)
The autosuggestions plugin has a bug with copy and paste so there is a workaround for that.
Append the following to the end of the config to activate the workaround.
## Fix for Slow zsh-autosuggestions copy&paste
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
zstyle ':bracketed-paste-magic' active-widgets '.self-*'
Save and exit the file.
Open new terminal window and enjoy Better Terminal Experience!
Bonus: Personal Theme, preconfigured¶
I've made a personal theme 3os based on the Bira theme with some tweaks.

Danger
The following commands will overwrite your current config if exists.
Make sure you have a backup of your config before proceeding!!!
wget -O ~/.oh-my-zsh/themes/3os.zsh-theme https://3os.org/assets/zsh/3os.zsh-theme
wget -O ~/.zshrc https://3os.org/assets/zsh/zshrc_config