---
title: "zsh"
description: "Replace bash with zsh as your login shell and add Oh My Zsh, autosuggestions and syntax highlighting."
canonical_url: "https://vinicunca.dev/windows-dev/guide/zsh"
---
# 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](https://vinicunca.dev/windows-dev/guide/nodejs).

```bash
sudo apt update
sudo apt install -y zsh curl unzip
```

### Make zsh your login shell

```bash
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:

```bash
echo $SHELL
# /usr/bin/zsh
```

## Oh My Zsh

[Oh My Zsh](https://ohmyz.sh/) is a framework for managing zsh configuration. It ships with hundreds of [plugins](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) and [themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes).

```bash
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:

```bash [~/.zshrc]
ZSH_THEME="robbyrussell"
plugins=(git)
```

## Recommended plugins

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

### Clone the plugins

```bash
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:

```bash [~/.zshrc]
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
```

### Reload your shell

```bash
exec zsh
```

- [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) suggests commands from your history as you type. Press `→` to accept a suggestion.
- [zsh-syntax-highlighting](https://github.com/zsh-users/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](https://github.com/unixorn/awesome-zsh-plugins).

## Alternative prompt: Starship

[Starship](https://starship.rs/) is a fast, cross-shell prompt that shows your Git branch, Node.js version and more. It works with or without Oh My Zsh.

```bash [Install]
curl -sS https://starship.rs/install.sh | sh
```

```bash [~/.zshrc]
# Add at the end of the file.
# If you use Oh My Zsh, also set ZSH_THEME="" so the prompts don't conflict.
eval "$(starship init zsh)"
```

Starship uses icons from [Nerd Fonts](https://www.nerdfonts.com/). 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**.

---

- [Oh My Zsh](https://ohmyz.sh/)


## Sitemap

See the full [sitemap](https://vinicunca.dev/sitemap.md) for all pages.
