zsh

Oh My Zsh
Replace bash with zsh as your login shell and add Oh My Zsh, autosuggestions and syntax highlighting.

zsh works almost exactly like bash, the default shell on Ubuntu, but adds better tab completion, plugins and themes. Run everything on this page inside your WSL terminal.

Install zsh

Install the packages

curl is used by most installers in this guide, and unzip is needed by fnm in the Node.js step.

sudo apt update
sudo apt install -y zsh curl unzip

Make zsh your login shell

chsh -s $(which zsh)

Enter your Linux password when prompted.

Open a new terminal

Close the tab and open a new one. The first time zsh starts without a ~/.zshrc, it shows a configuration wizard. Press 0 to create an empty ~/.zshrc; Oh My Zsh replaces it in the next step.

Confirm the shell:

echo $SHELL
# /usr/bin/zsh

Oh My Zsh

Oh My Zsh is a framework for managing zsh configuration. It ships with hundreds of plugins and themes.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

The installer backs up your existing ~/.zshrc and writes a new one. Plugins and the theme are configured there:

~/.zshrc
ZSH_THEME="robbyrussell"
plugins=(git)

These two community plugins aren't bundled with Oh My Zsh, so clone them into its custom plugins directory first.

Clone the plugins

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Enable them in ~/.zshrc

Keep zsh-syntax-highlighting last in the list:

~/.zshrc
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Reload your shell

exec zsh
  • zsh-autosuggestions suggests commands from your history as you type. Press → to accept a suggestion.
  • zsh-syntax-highlighting colors commands as you type, so typos and unknown commands stand out before you press Enter.

Find more in awesome-zsh-plugins.

Alternative prompt: Starship

Starship is a fast, cross-shell prompt that shows your Git branch, Node.js version and more. It works with or without Oh My Zsh.

curl -sS https://starship.rs/install.sh | sh

Starship uses icons from Nerd Fonts. Install one on Windows (for example with winget install -e --id DEVCOM.JetBrainsMonoNerdFont) and select it in Windows Terminal under Profiles › Ubuntu › Appearance › Font face.