Supercharging Your WSL Ubuntu Terminal with Oh-My-Zsh

Sufiyan Khan
3 min readAug 11, 2023

--

I want to share my transition from the familiar realm of the Mac terminal to the uncharted territory of Windows. My experience of missing the beloved terminal and discovering the power of zsh, an enhanced version of bash, with its abundant new features and endless customization possibilities. Follow along.

Install Windows Terminal

Installation couldn’t be more straightforward, just head to Microsoft Store and install the application. Windows Terminal will also continue to receive automatic updates through the store, thus, you will always have the latest stable version.

Install WSL

WSL requires Hyper-V support. The new machines have them enabled by default at the bios level, and we also require enabling it on the OS level.

Enabling Hyper-V

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Installing WSL

wsl --install

Now you are set. You can start off by configuring your username and password and head off to install Z shell.

Install ZSH

sudo apt-get update
sudo apt-get install zsh -y

echo $SHELL
chsh -s /usr/bin/zsh

Restart your terminal, and you will be prompted for some configuration options. Once done with your preferred settings, press “0” to save all the changes. Setup is completed now, you can verify shell with command echo $SHELL

Install oh-my-zsh

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

Change Theme

By default, oh-my-zsh will apply the “robbyrussell” theme. Change theme from ~/.zshrc. ZSH also comes with other default themes stored in the ~/.oh-my-zsh/themes directory, my favorite is agnoster.

Hide your name

If you want to hide the computer name and display just your username, edit .zshrc and paste the below right at the bottom of the file.

prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
fi
}

If you also want to hide your username, comment out line prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"

Install powerline fonts

Some themes require powerline fonts, you will require to install fonts on Windows and edit your Ubuntu appearance from settings. You will get the fonts from here https://github.com/powerline/fonts (use install.ps1 for windows)

You are all set and ready to use oh-my-zsh now.

Bonus Tips

zsh-syntax-highlighting

zsh-syntx-highlighting is a plugin for the Zsh shell that provides real-time syntax highlighting for commands and their arguments as you type. It helps visually distinguish between different types of commands, options, paths, and variables, making it easier to spot errors and understand the structure of your commands in the terminal.

Follow the installation guide HERE.

This is what my terminal looks like before and after installing the tool:

Before Installation
After Installation

There are so many cool things you can do with Linux, and it is by far the most customizable operating system out there. With time, Linux will become more and more usable within Microsoft, so watch this space! Enjoy using your new setup, and if you’re trying Linux for the first time — Welcome!

--

--