Zsh (Z shell) is a powerful and highly customizable shell designed for interactive use and scripting. It includes many features like advanced tab completion, themes, and plugins, making it a popular choice for developers and power users.
This tutorial will guide you through the steps to install and configure Zsh on your system.
Step 1: Install Zsh
On Debian/Ubuntu
sudo apt update
sudo apt install zsh
On macOS (using Homebrew)
brew install zsh
Step 2: Change Default Shell to Zsh
Linux/macOS
-
Change the default shell:
chsh -s $(which zsh)
-
Log out and log back in for the change to take effect.
Step 3: Install a Framework (Optional but Recommended)
Oh My Zsh is a popular Zsh framework that simplifies plugin and theme management.
Install Oh My Zsh
Run the following command:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Step 5: Customize Zsh
Change Theme
- Open the Zsh configuration file:
vim ~/.zshrc
- Locate the
ZSH_THEME
variable and change its value to your desired theme:ZSH_THEME="agnoster"
- Save the file and restart Zsh:
source ~/.zshrc
Add Plugins
- Install the necessary plugins:
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
- Open the Zsh configuration file:
vim ~/.zshrc
- Add plugins to the array:
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
- Save and reload Zsh:
source ~/.zshrc
Congratulations! You have successfully installed and configured Zsh. Enjoy your enhanced terminal experience!