Life hack

How to use zsh (or another shell) in windows 10

Setelah Bash telah terinstalasi, Anda hanya membuthkan installa shell yang anda butuhkan dari Bash. Untuk melakukan hal ini Anda hanya butuh menggunakan perintah apt atau apt-get saja.

Untuk menginstallnya pada ubuntu, Buka Bash Shell dan ikuti perintah di bawah ini :

Tekan Y apabila ada pertanyaan, dan kemudian tekan Enter untuk melanjutkannya. Apt-get akan mendownload secara otomatis dan zsh sudah dapat digunakan.

Cara pengunaan ZSH (atau Shel lain)

Untuk menjalankan ZSH atau shell lain setelah terinstalasi, hanya cukup mengetikkan nama shellnya dalam shell Bash , kemudian tekan Enter . Contohnya :

Cara penggunaan ZSH secara langsung tanpa harus menggunakan Shell Bash

Anda dapat menjalankan shell ZSH secara langsung dengan perintah berikut :

How to use zsh (or another shell) in windows 10

Cara penggunaan Bash menjalankan secara langsung Shell ZSH

Anda juga dapat menjalankan ZSH secara langsung tanpa harus menggunakan Bash terlebih dahulu.

Caranya adalah sebagai tambahkan beberapa baris berikut pada file .bashrc dengan editor apapun yang ada sukai contohnya nano atau vi , beberapa barikut yang harus ditambahkan adalah :

How to use zsh (or another shell) in windows 10

Setelah ditambahkan pada file yang diedit tersebut, simpan kemudian. ketikkan kembali pada CMD ketik bash secara otomatis akan menjalankan shell ZSH.

Demikian tips untuk bagi para pengguna Windows yang akan menjalankan Shell ZSH pada Windows SubSystem.

How to use zsh (or another shell) in windows 10

Jun 25, 2017 · 2 min read

A few months ago, I wrote an article to show how to get Zsh in WSL on Windows 10. But I haven’t exactly shown how to make it the default shell. In facts, you can’t (not the “official” way anyway), because bash.exe in System32 folder is meant to call bash shell, not zsh. So no matter how you try to set zsh as the default shell through chsh -s $(which zsh) , it doesn’t work if you still call to bash.exe everytime you use WSL.

Knowing this, th e WSL team has made some changes. In the recent Windows 10 Insider builds for Windows 10 Fall Creator Update, there’s a wsl.exe file in System32 which performs two functions according to a member of the WSL team:

  1. When run without arguments, it will launch your default user’s default shell (which is configurable via the chsh command).
  2. When run with arguments, it is an easy way to run a specific Linux binary (wsl.exe ls).

So that means you can actually use the true default shell now if you call to wsl.exe instead of bash.exe. Here’re examples, Hyper Terminal and Visual Studio Code. First of all, you have to set zsh as the default shell, (obviously). Type this to the current WSL terminal you’re using (like “Bash on Ubuntu on Windows”)

Now back to Hyper, edit the settings file where the shell and shellArgs options are like this:

How to use zsh (or another shell) in windows 10

That’s Hyper, how about Visual Studio Code? It’s the same. Just change “bash.exe” to “wsl.exe” in the settings file

There we go! Everything should work fine now.

The short guide

How to use zsh (or another shell) in windows 10

Sep 28, 2016 · 3 min read

How to use zsh (or another shell) in windows 10

At the moment I am writing there are a bunch of articles that explain how to install Ubuntu on Windows. That’s because I decided to just move forward. Still if you want to review that step I recommend watching the tutorial made by Scott Hanselman here.

Once you have installed the Windows subsystem for linux, you can proceed and install ZSH as usual running the following command in your terminal.

Fish shell also works if yo u want to use another shell to specify the name of that shell instead of ZSH . To install it, just run the following command:

Now that this is done, you must type in your terminal zsh and you will be prompted through the first-time setup process. At this point will start the configuration profile. Type 2 to create a configuration profile with the recommended default settings. To get out from ZSH and going back to bash you can type exit .

You could simply run zsh. But the following lines will ensure that Bash only launches ZSH when you open Bash. This will avoid causing problems for other software. Making it to launch ZSH and directly bypassing Bash. To accomplish this you’ll need to edit your

/.bashrc . Swap out open with your favorite editor command, such as nano, vim or emacs, ( for example nano

/.bashrc ) and then paste the following code somewhere you like in the file .

Oh My Zsh gets installed by running one of the following commands in your terminal. You can install it via the command-line with either curl or wget.

via curl

sh -c “$(curl -fsSL”

via wget

sh -c “$(wget -O -)”

ZSH Settings Link

ZSH settings are stored in a .zshrc file located in your home directory and you can view it by running nano .zshrc from the terminal.

Now Look for ZSH_THEME=”robbyrussell ” — this is the default theme that comes with ZSH. I recommend setting this to ZSH_THEME=”random” , or using a fancy one like ZSH_THEME=”agnoster”.

What’s missing and how to fix it

Color schemes are mostly a manual process, you can play with them all that you want or leave them as default. Also you can install the font Menlo for powerline in your PC just by clicking on the font with the right click, and later choosing it on your terminal or CMD. This will give you all those missing symbols you need for making this to look just fine with those themes.

How to use zsh (or another shell) in windows 10

Mar 17, 2020 · 4 min read

WSL is probably one of the better options for development on Windows systems actually. Let’s give a better look to the terminal.

You can find this guide also in my repository on GitHub. If you like it, don’t forget to give me a ⭐!

As Wikipedia says, Windows Subsystem for Linux ( WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10 and Windows Server 2019.

Basically, it permits you to use the Linux layer on Windows, so you will be able to use Linux commands on the terminal. And for that, Microsoft Terminal is a good option.

Microsoft Terminal is an open-source project from Microsoft and a feature recently added to the OS. It is a new terminal that allows you to use different consoles like CMD, Powershell, Azure, Ubuntu, and etc. Crazy.

But…what if we can use ZSH on the terminal too? Doesn’t sound it awesome? Let’s see.

According to Wikipedia, The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.

macOS Catalina, released in October 2019, adopted Zsh as the default shell, replacing Bash.

Definitely, a good shell that you must try at least once, and you can do it in the Microsoft Terminal. So if you are using Windows 10 OS, you will be able to get Linux commands on a brand new terminal, with a cool look and with Zsh inside. Cool enough.

Let follow these steps:

1. Install the new Microsoft (Windows) Terminal

You can install it from the Microsoft Store or from the GitHub repository. I personally think that is easier if you install it directly from the Store. With just a few clicks, you will get your brand new terminal installed in your Windows.

2. Later, you must enable Windows Subsystem for Linux (WSL)

This step is easy. Just open your PowerShell with Admin privileges and write the following command to enable WSL:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Later, you have to restart your computer.

3. Download Ubuntu for Windows

Do it directly from the Microsoft Store. Easy step.

4. Set up your Microsoft Terminal with Ubuntu

For that, I invite you to use these following setup:

As you can see, the name of the colorScheme is Scope, since we are going to use this scheme. Later I will explain how to create the scheme.

Take care of the “startingDirectory” row, you will have to add your preferred starting directory.

5. Install Oh My Zsh plugin

For those who don’t know what is Oh My Zsh, it is an open source framework for Zsh. For me, is one of the best existing tools for consoles out there. Trust me, it is worth to try it.

To install Oh My Zsh, please, visit their GitHub repository and read the documentation.

6. Last step: insert the Scope color scheme

Why Scope? Scope is my company. In this case, I will add our color scheme, but you are free to use the colors that you like the most.

Scope is a git analytics tool. We help software managers and engineers to better understand the workflow of the code processes to identify bottlenecks, reduce technical debt, compare trends and become more productive.

For that, go, follow these steps:

  1. Open Microsoft Terminal.
  2. Click in the arrow down, to the right of the tab.
  3. Click on Settings.
  4. A profiles.json file will be opened. Use the code editor you like most. I personally use VScode.
  5. Copy the following commands in the profiles section of the json file.

How to use zsh (or another shell) in windows 10

There you got. That is the final result. As I said, you are free to use the colors you like most. For that, you have to change the colors on the Scope color profile (the commands above).

Feel free to try different Oh My Zsh themes too! You will find all of them in their themes gallery.

How to use zsh (or another shell) in windows 10


How to use zsh (or another shell) in windows 10

Ubuntu a ostatné distribúcie Linuxu dostupné v systéme Windows 10 používajú štandardne Bash shell, ale nie je to vaša jediná možnosť. Systém Windows má vrstvu kompatibility pre spustenie softvéru Linux v systéme Windows a môžete ho použiť na spustenie Zsh alebo akéhokoľvek shell, ktorý uprednostňujete.

Zsh shell teraz funguje na Windows 10. Môžete mať Bash automaticky spúšťať Zsh pri každom spustení. Oh My Zsh tiež pracuje na prispôsobení vašej Zsh shell v systéme Windows, rovnako ako v Linuxe.

Začnite inštaláciou Bash

Pred inštaláciou vášho shellu, musíte najprv povoliť podsystém Windows pre Linux a nainštalovať prostredie Linux. V tomto článku budeme používať Ubuntu ako príklad, ale podobný proces môžete vykonávať aj na openSUSE a iných distribuciách Linuxu.

How to use zsh (or another shell) in windows 10

Ak ste už nainštalovali systém Bash v systéme Windows, je dobré ísť.

Ako nainštalovať Zsh (alebo iný Shell)

Po nainštalovaní balíka Bash stačí nainštalovať shell, ktorý chcete použiť, v rámci Bash. Vykonáte to pomocou príkazu apt-get, rovnako ako inštaláciu akéhokoľvek iného softvérového balíka na Ubuntu Linux.

Ak chcete nainštalovať Zsh na Ubuntu, otvorte shell Bash a spustite nasledujúci príkaz:

sudo apt-get install zsh

Po zobrazení výzvy stlačte tlačidlo “y” a pokračujte stlačením tlačidla Enter. Apt-get automaticky stiahne a nainštaluje Zsh z úložiska Ubuntu.

How to use zsh (or another shell) in windows 10

V iných distribuciách systému Linux stačí použiť príkaz inštalácie softvéru distribúcie systému Linux. Napríklad budete musieť použiť príkaz zypper na openSUSE.

Ak chcete použiť iný shell, zadajte názov tohto shell namiesto Zsh. Napríklad sme videli hlásenia, že Rybí shell tiež funguje dobre. Ak ho chcete nainštalovať, spustite nasledujúci príkaz:

sudo apt-get install fish

Ako spustiť Zsh (alebo iný Shell)

Ak chcete nainštalovať Zsh alebo iný shell po jeho nainštalovaní, zadajte názov shellu do výzvy Bash a potom stlačte kláves Enter. Ak napríklad chcete začať používať Zsh z Bash, stačí napísať:

Budete vyzvaní, aby ste prejsť prvý proces nastavenia Zsh a vytvorili konfiguračný profil po prvom spustení. Zadajte “2” a vytvorte konfiguračný profil s odporúčanými predvolenými nastaveniami.

Ak chcete opustiť shell zsh a vrátiť sa do Bash, stačí spustiť nasledujúci príkaz:

Ako priamo spustiť Zsh

Môžete spustiť shell Zsh priamo príkazom, ako je nasledujúci:

wsl zsh bash -c zsh ubuntu -c zsh opensuse-42 -c zsh sles-12 -c zsh

Ako urobiť Bash automaticky spustiť Zsh

Môžete tiež mať Bash automaticky prepnúť na Zsh pri každom spustení.

Aby ste to urobili, musíte upraviť súbor .bashrc. Bash spustí príkazy v tomto súbore pri každom spustení. Môžete vykonať úpravy pomocou ľubovoľného textového editora, ktorý sa vám páči, vrátane vi, ale vysvetlíme proces pomocou nano.

Ak chcete otvoriť súbor .bashrc v nano, spustite nasledujúci príkaz:

Do súboru pridajte nasledujúce riadky. Môžete jednoducho pridať riadok “exec zsh”, ale nasledujúce ďalšie riadky zabezpečujú, že Bash iba spustí Zsh pri otvorení okna Bash. Tým sa vyhnete problémom pre iný softvér.

# Launch Zsh if [ -t 1 ]; then exec zsh fi

Ak chcete spustiť iný shell, zadáte príkaz shella namiesto príkazu “zsh”.

How to use zsh (or another shell) in windows 10

Po vykonaní zmien stlačte kombináciu klávesov Ctrl + O a potom klávesu Enter, aby ste súbor uložili. Stlačením klávesov Ctrl + X ukončíte nano.

Teraz, keď otvoríte skratku Ubuntu (alebo iné skratky pre distribúciu Linuxu) v systéme Windows, spustí sa s shellom Zsh.

Ak chcete zmenu zmeniť, upravte súbor .bashrc a odstráňte sekciu, ktorú ste pridali.

Všetky alternatívne linky Linuxu by mali fungovať teoreticky. Ak tomu tak nie je, spoločnosť Microsoft potrebuje opraviť základný podsystém systému Windows pre systém Linux tak, aby správne spúšťal viac Linuxového softvéru. Môžete zobraziť existujúce chyby a nahlásiť nové chyby spoločnosti Microsoft na stránke BashOnWindows GitHub.

How to use zsh (or another shell) in windows 10

Ubuntu和 Windows 10上提供的其他Linux发行版默认使用Bash shell,但这不是您唯一的选择。 Windows有一个用于在Windows上运行Linux软件的兼容层,您可以使用它来运行Zsh或任何您喜欢的shell。

Zsh shell现在可以在Windows 10上运行。每当启动它时,您都可以让Bash自动执行Zsh。 哦,我的Zsh也适用于在Windows中定制Zsh shell,就像它在Linux中一样。


How to use zsh (or another shell) in windows 10


Bash安装后,你只需要安装你想在Bash中使用的shell。 您可以使用apt-get命令执行此操作,就像在Ubuntu Linux上安装任何其他软件包一样。

How to use zsh (or another shell) in windows 10

如果您想使用其他shell,请指定该shell的名称而不是Zsh。 例如,我们已经看到有报道称Fish壳也能很好地工作。 要安装它,你需要运行以下命令:



How to use zsh (or another shell) in windows 10


要做到这一点,你需要编辑你的.bashrc文件。 每次启动Bash都会在这个文件中运行命令。 您可以使用任何您喜欢的文本编辑器进行编辑,包括vi ,但我们将使用nano来解释该过程。

将以下行添加到文件中。 您可以简单地添加“exec zsh”行,但以下附加行确保Bash只在您打开Bash窗口时启动Zsh。 这避免了导致其他软件的问题。

How to use zsh (or another shell) in windows 10

进行更改后,请按Ctrl + O,然后按Enter保存该文件。 之后按下Ctrl + X退出nano。

理论上,所有可选的Linux shell都应该可以工作。 如果没有,微软需要修复Linux的底层Windows子系统,以便正确运行更多的Linux软件。 您可以在BashOnWindows GitHub页面查看现有的错误并向Microsoft报告新的错误。

  • 发布于 2016-06-13
  • 阅读(760)
  • 评论(0)

How to use zsh (or another shell) in windows 10

Bash shell中与到达的Windows 10周年纪念更新是骗人的。 它不仅仅是Bash – 它是一个在Windows上运行Linux软件的兼容性层。 你可以使用它运行Zsh或任何其他你喜欢的shell。

作为内幕构建14342 ,该岩组壳现在可以在Windows 10,你可以有,只要你启动它Bash自动执行岩组。 哦,我的岩组也适用于自定义Windows上的岩组的外壳,只是因为它在Linux上。


安装你所选择的外壳之前,你首先需要启用Windows子系统用于Linux和安装的Bash 。 这将在Windows上安装一个完整的Ubuntu用户空间环境,包括Bash shell。

How to use zsh (or another shell) in windows 10


一旦安装了Bash,你只需要在Bash中安装你想要使用的shell。 你可以使用apt-get命令,就像你在Ubuntu Linux上安装任何其他软件包一样。

How to use zsh (or another shell) in windows 10

如果要使用另一个shell,请指定该shell的名称而不是Zsh。 例如,人们报告鱼壳也工作。 要安装它,您可以运行以下命令:


How to use zsh (or another shell) in windows 10


由于Microsoft实现此功能的方式,您不能直接启动Zsh并绕过Bash。 要开始运行Linux软件,您需要启动一个Bash窗口并从那里运行软件。 但是,您可以在启动时自动切换到Zsh。

为此,您需要编辑.bashrc文件。 Bash将在每次启动时运行此文件中的命令。 为此,可以使用任何你喜欢的文本编辑器,包括做VI ,但我们会使用讲解过程中纳米 。

How to use zsh (or another shell) in windows 10

将以下行添加到文件。 你可以简单地添加“exec zsh”,但是下面几行将确保Bash只在你打开一个Bash窗口时启动Zsh。 这将避免对其他软件造成问题。

How to use zsh (or another shell) in windows 10

完成后,按Ctrl + O,然后按Enter键保存。 按Ctrl + X可退出nano。

所有备选的Linux shell在理论上应该工作。 如果没有,Microsoft需要修复底层的Windows子系统Linux,以便正确运行更多的Linux软件。 您可以查看现有的缺陷,并在报告新的bug微软BashOnWindows GitHub上页 。

I have been using Conemu as my goto terminal, i.e. till Micrsoft released the beta version of Windows Terminal. Windows terminal has a tabbed window which allows you to have multiple consoles at the same time, allows for a lot of customizations.

I have also become an afficiando of Windows Subsystem for Linux (WSL) ever since it made its appearance on Windows 10. I already blogged about the latest font called “Cascadia Code” released by microsoft and how you can use it in Visual studio code and other IDEs, you can read it here. In this blog I will take you through to the steps to beautify your terminals.

Bash on WSL

“Oh My Zsh” is a wonderful tool which comes bundled with thousands of helpful functions, helpers and plugins.

  1. Open the windows terminal and open tab for your WSL.
  2. Run the following command.

Now the bash terminal would look something like this How to use zsh (or another shell) in windows 10

The configuration file would be stored in zshrc stored in the root directory, you could add themes and plugins as needed. I have uploaded my zshrc to this gist, if you are looking for an example.

[UPDATE] Plugin for ZSH

Recently discovered another gem for windows terminal, powerlevel10k and autocomplete plugin for ZSH

Powershell or Powershell Core

Oh-My-Posh is windows version of Oh-My-zsh, it contains minimal but sufficient plugins and themes that would delight your experience with the terminal.

  1. Open Powershell in the terminal
  2. Install the following modules

Close and re-open the tab and you should be noticing your powershell modified.

How to use zsh (or another shell) in windows 10

You could change the themes as you deemed fit by modifying your profile.

Glyphs and Nerd fonts

If you noticed the above image, the square boxes are because of the missing glyphs in the font used for the terminal. Cascadia code doesn’t have all the glyphs and the nerd fonts patched, you can patch it yourself using the Nerd fonts.

I have already patched Cascadia code and you can download it here

Once you have downloaded the font and installed it, update the terminal font to CascadiaCode Nerd Font, your prompt should start looking like this now How to use zsh (or another shell) in windows 10

Updated: October 23, 2019

Share on

Leave a comment

You may also enjoy

Moving docker contents to another drive

Docker desktop is now available with WSL integration, provided that you are on windows 10 1909 build, it brings in a lot of performance improvements to the e.

Kubernetes TLS secrets watcher

We have been managing a multi-tenant kuberentes cluster with more than 100 nodes, hosting multiple ingress services exposed to the public domain. I will cove.

Moving from Windows 10 to Ubuntu

I have been an afficianado of whatever Microsoft builds, since I was introduced to the computers. I have used windows on personal computer since win’98 days.

Must have VSCode extensions for Cloud Developers

Visual studio code is the most preferred IDE amongst the frontend developers, its opensource and supports a wide variety of plugins. In this blog I will list.

Coding Architect

Now Git, the Azure CLI, and Kubernetes Kubectl are used more and more, the bash prompt is one of the most productive ways to do your daily work. When using Windows, the usage of WSL (2) is a must-have when it comes to having a Linux shell to execute bash scripts. This works nice but with Oh-My-Zsh you can make the command-prompt look- and behave better so you can do your work more efficient.

This blogpost tells you the steps to take to get a prompt on Windows with WSL using Visual Studio Code. Actually, this blog post is a reminder for me. It’s how I have configured the WSL and VS Code. It looks like this:

Oh-My-Zsh is a plugin that runs on top of ZSH. Using Oh-My-Zsh instead of the default bash prompt has several advantages:

  • Themeable prompts. By default, the robbyrussell theme is configured. There are many themes to choose from: When prompted in a git repo, Zsh shows information about the Git status for example.
  • Advanced command history. Works over shells and even works after reboots. See the whole history with “alt+/”. Very powerful is searching in history using a partly typed command: for example type az and when you hit your arrow up, it only shows the commands in history which start with az.
  • Spelling correction. Type case insensitive and Zsh finds out what you mean.
  • Auto completion. Type – after a command and tab through the command options.
  • Keybindings. Type bindkey to see all keybindings.
  • Globbing. Is a short expression that lets you filter files. For example:
    ls mydir/**/*.json to have all json files in any directory within mydir.
  • Minimize keystrokes. Here is a cheatsheet to make you type less.
  • Plugin support. By default the Git plugin is already configured. Let’s configure the zsh-syntax-highlighting and zsh-autosuggestions. There are much more plugins which can be found here: or here

With the needed knowledge a couple of them should be possible in the bash prompt as well, but Oh-My-Zsh makes it very easy.

This list is not extensive. There are so many possibilities, too many to sum them up here. In short: Using Oh-My-Zsh makes your prompt highly customizable using community-created plugins and themes so it makes your life easier.

I’m using the prompt a lot, to type and execute commands. Very often I need to execute a command in a script file. Therefore I like to use Visual Studio Code together with the terminal within VS Code. So I have only 1 window open to have both the file and the terminal.

I could use Windows Terminal or Cmder if I would only use the command prompt. But having a file ready to be filled with commands or executing commands which are already in a file, I really like to use Visual Studio Code.

Using Oh-My-Zsh also works in Windows Terminal of course and also if you just open WSL itself. This blogpost shows my personal configuration.


A. Install Windows Sub System 2 (WSL)

Second and optionally (but recommended because of speed), install WSL 2:

C. Install Powerline fonts in Windows
To have a correctly working agnoster theme, it’s needed to download and install the needed fonts.

Open a Powershell command prompt:

Installation and configuration steps

1. Open Ubuntu

2. Install Zsh (and curl and git)

3. Install Oh-My-Zsh

4. Change the Theme to agnoster

5. Make the directory more readable by changing the back color to a bit lighter blue

The background of the prompt where the directory part is shown is too dark. Let’s make it light blue:

6. Enable autocorrection
It’s disabled by default.

7. Optionally: Enable autosuggestions

Clone the Git repo

Add the plugin to the list in the oh-my-zsh configuration

find the following by scrolling down:

make sure it looks like this:

Add the following line right under the plugins part to prevent error message: “Insecure completion-dependent directories detected”

Save the file with CTRL-X. Enter y and hit enter to save the file to the same filename.

8. Optionally: Enable syntax highlighting

Clone the Git repo

Make sure you have ZSH_DISABLE_COMPFIX=true configured as explained in step 7.

9. Optionally: Do not show the username in the prompt
Do not show the username if you are working on your local machine as yourself. (working on a remote system as another person does show the username)

Open the .zshrc file to edit it

Add the following to bottom the .zshrc file:

10. Optionally: Have the cursor on the next line by default
It’s a personal preference. After this change, the cursor is always on the line just below the fancy prompt.

Search for the following part:

add \n to the longest line. The result will be this:

11. Fix strange characters in the prompt

The prompt still shows strange characters. Fix it in Visual Studio Code and in the terminal of Ubuntu. To fix it do the following:

11a Configure Visual Studio Code

Open Visual Studio Code and make sure to configure the following settings:
Of course, you can also use one of the other powerline fonts.
The second line makes the WSL the default shell when opening the terminal.

Restart VS Code to apply the changes.

11b Configure Ubuntu terminal

Open Ubuntu, click on the Ubuntu logo on the right top and choose for defaults.

Select a Powerline font like DejaVu Sans Mono for Powerline

Restart the terminal to apply the changes.

11c Configure Windows Terminal

Choose for the Settings in the Windows Terminal

Add the following line to the profile of Ubuntu:

Published On Sat 17 October, 2020
  • Homepage
  • Tactics
  • Productivity
  • How To Become A Windows Terminal GOD – With WSL2, Zsh and Oh My Zsh

The Windows Vs Mac war has been raging on for decades. I’m happy to admit I like both. Yes, I can hear you silently judging me. I just don’t care. If you ever hear a mac fan evangelize why the MAC is better suited for coding, you will quickly hear how bash and the Linux terminal kicks the Windows command line ass. It’s all true it does. The command line sucks when comparing it to bash. Thankfully, Microsoft has been working on something sneaky. You can now run a Linux kernel directly on windows

In this tutorial, you will learn how to run Linux natively on Windows using WSL2. The really cool thing about WSL2 is that it will allow you to run bash natively on Windows, meaning WSL2 gives us new super-powers. We can finally ditch the built-in Windows command line and instead use something a little more productive. We can now install ZSH and Oh My Zsh on Windows!

For those of you new to Z/Zsh you are in for a treat! Zsh is a new and improved shell that is based on bash. With the Zsh shell, you can install Oh My Zsh. Oh My Zsh can be used to customize your shell with themes and plug-ins. You no longer need to make do with having a dull and boring terminal! Oh My Zsh has some tricks up its sleeves that will make you more efficient. Sounds good right?

This whole process should take you around 30 minutes in total. The first step is to install WSL and Ubuntu. Next, we will install Zsh and Oh My Zsh. Finally, we will pimp up the terminal, installing some cool themes and plug-ins using Oh My Zsh. With Zsh and its plug-ins installed you become a Windows terminal productivity ninja. So buckle up. it’s going to be one hell of a ride

Installing WSL

The steps to install WSL2 are well documented on the Microsoft site and can be found here. An overview of the important things (some of which are not covered in the MS tutorial) is shown below:

  • Have docker desktop for Windows installed
  • Have SVN enabled in your BIOS settings. On my laptop is was disabled and stopped WSL2 from installing!
  • Within ‘turn windows feature on and off’ ensure:
    • Windows Hyper-vision Platform is enabled
    • Windows Subsystem for Linux is enabled

After you have WSL2 installed, you can install a Linux distribution, like Ubuntu. This is how we can run bash on Windows. To install Ubuntu. open up the Windows Store and search for:

If you are at work and the MS stories blocked then you can manually download Ubuntu from this page.

While you are in the Windows store you will also want to install:

  • Windows Terminal

If the store is blocked on your PC, you can manually download it here. If everything goes to plan then you should be able to open the new Windows Terminal program and you should have an option to open a bash Ubuntu shell!

How to use zsh (or another shell) in windows 10

Installing And Configuring Z and Oh My Zsh

You can install both Z and Oh My Zsh from your new bash shell. Type in these two commands (remember to run the terminal as an admin 😊):

After both of these great tools have been installed we can customize things! Oh My Zsh can be configured via its settings file, called .zshrc :

First, we will change the theme from the default which will be set to ‘robbyrussle’. From within .zshrc , find the line that says Theme=robbyrussell . Update this to use a different theme. A full list of all the themes can be found here. Two themes that I like and recommend are agnoster and powerlevel9k. The configure to change .zshrc to use the powerlevel9k theme is shown below, simples!

Next, let us install some plug-ins. Within .zshrc find this line:

To install a new plug-in simply add a reference to it from within this list. For example, to install zsh-syntax-highlighting , clone this repository from the command line like this:

Add a reference to zsh-syntax-highlighting within your plug-in options like this:

Another plug-in that I recommend is called Z. Z ships with Oh My ZSH, however, it is not enabled by default. To enable it, simply add a reference to it within your plugin’s options:

For reference, the plug-ins that I use are git , node , npm , bower , brew , extract , z , zsh-syntax-highlighting . Hopefully, by now you get the gist of how to install themes and plug-ins for Oh My Zsh. A full list of all the plug-ins can be found here. You are now a shell Ninja! You know how to install Ubuntu, install Z, OH MY ZSH, as well as trick it out. Happy Coding!