Z shell works almost identically to the standard BASH shell found on default Linux installs. What makes it different is its support for plugins and themes, along with some extra features like spelling correction and recursive path expansion. It's time to throw BASH in the trash!
Requirements
- Windows 10 or 11
- WSL or WSL2
The terminal commands used are based on Ubuntu/Debian-based Linux distributions.
🐚 Installing Zsh
Zsh can be installed with one command:
sudo apt install zsh
After installing, type the zsh
command. Zsh will ask you to choose some configurations. We will do this later on while installing oh-my-zsh, so choose option 0
to create the config file and prevent this message from showing again.
😱 OhMyZsh
The most popular plugin framework by far is OhMyZsh. It comes preloaded with loads of plugins, themes, helpers, and more. It can help with productivity for sure, but more importantly, it just looks cool 😎.
cURL
First off, we need to make sure we have cURL installed. Short for "Client URL", it's a way to transfer data from the command line, and that's how we will download OhMyZsh.
sudo apt install curl
Installing OhMyZsh
Enter the following command into your terminal to install OhMyZsh:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
That's it! You should now see a .oh-my-zsh
directory inside of your home directory. To change your plugins and themes you will need to edit your .zshrc
file, also found in your home dir.
Here is a list of all the themes and plugins that come bundled with OhMyZsh.
🔌 Plugins
There are countless plugins available, but these are the two I recommend most.
zsh-autosuggestions
Autosuggestions for zsh, It suggests commands as you type based on history and completions.
- 1. Clone this repository into
$ZSH_CUSTOM/plugins
(by default~/.oh-my-zsh/custom/plugins
)
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- 2. Add the plugin to the list of plugins for Oh My Zsh to load (inside
~/.zshrc
):
plugins=(git zsh-autosuggestions)
- 3. Start a new terminal session.
zsh-syntax-highlighting
This package provides syntax highlighting for the shell zsh. It enables highlighting of commands whilst they are typed at a zsh prompt into an interactive terminal. This helps in reviewing commands before running them, particularly in catching syntax errors.
- 1. Clone this repository in oh-my-zsh's plugins directory:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- 2. Activate the plugin in
~/.zshrc
:
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
- 3. Start a new terminal session.
More Plugins
A huge list of plugins can be found at the awesome zsh plugins repo.