Install ZSH (Oh My Zsh) on Ubuntu 20.04 LTS with syntax-highlighting

If you want to see a nice console like below then this article is for you.

  • As usually we will update/upgrade all packages
sudo apt-get update
sudo apt-get upgrade
  • Install ZSH
sudo apt-get install zsh
  • Install needed packages for ZSH to display correctly fonts
sudo apt-get install powerline fonts-powerline
  • Clone the Oh My Zsh Respo
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
  • Create a New ZSH configuration file
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
  • Set up a Fancy theme for your Terminal – Open .zshrc File using nano editor
nano .zshrc
  • Find the line ZSH_THEME="robbyrussell" replace robbyrussell with agnoster theme in .zshrc
ZSH_THEME="agnoster"
  • Change your Default Shell
chsh -s /bin/zsh
  • Install ZSH Syntax Highlighting for Oh My Zsh
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME/.zsh-syntax-highlighting" --depth 1
  • Add syntax-highlighting in .zshrc Configuration
echo "source $HOME/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> "$HOME/.zshrc"
  • Make reboot
sudo reboot

BONUS “Bash completion”

If you don’t have installed bash completion, I really recommend you to install it.

sudo apt-get install bash-completion

In the end you need just to use a “Tab” to have auto bash completion

Leave a Reply

Your email address will not be published.