Skip to main content

Zsh

Zsh, or the Z Shell, is a powerful and versatile Unix shell that enhances the capabilities of the traditional Bourne Shell (sh), with features from Bash, ksh, and tcsh. It is known for its advanced interactive features, such as customizable prompts, rich command-line completion, and globbing (advanced pattern matching). Additionally, Zsh offers extensive scripting capabilities, making it a robust choice for both interactive use and scripting tasks. Its extended file globbing allows users to manipulate files in a more refined and flexible way. Zsh is particularly popular among developers and power users who appreciate its efficiency in command execution and the ability to tailor the environment to their workflow. With themes and plugins, users can customize their experience further, making Zsh a modern, user-friendly choice for daily shell interactions and advanced scripting needs.

Install Zsh on Ubuntu

  1. Update the system repository
sudo apt update
  1. Install Zsh
sudo apt install zsh -y
  1. Confirm zsh version
zsh --version

Configure Zsh

  1. Initial configuration
zsh
  • Use option 2 to populate the ~/.zshrc with the recommended configuration. May be updated later on.
  1. Set Zsh as the Default Shell
echo $SHELL
chsh -s $(which zsh)

Install Oh My Zsh

  1. Install from GitHub source
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
  1. Install Auto-Suggestions plugin
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  • Add the plugin to ~/.zshrc
plugins=(git zsh-autosuggestions)
  1. Enable Syntax Highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  • Add the plugin to ~/.zshrc
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)