How to install and run (Oh-My-) zsh on Windows

I run zsh on Windows. But why? Some time ago, when I was still using a Mac, one of my colleagues suggested to use zsh instead of bash.

Since then I switched to a Surface Book which I happily preferred over OS X mac OS and mainly use cmdr as my shell. Now the Windows 10 Anniversary update is out, and it comes with “Bash on Ubuntu on Windows“.

Now, while having bash on my fingertips again, my colleagues’ suggestion came back to my mind, and I tried to use zsh again.

Installation of zsh on Windows

Installation of zsh on Bash on Ubuntu on Windows is as easy as installing it on plain Ubuntu. You start bash and issue the following command:

sudo apt-get install zsh

This will use the default package manager apt of the Ubuntu that runs on the Linux Subsystem on Windows to install the zsh package.

You can directly try it out by simply calling zsh from your shell to open a new zsh from Bash.

Making zsh on Windows your default shell

I wanted zsh to start directly when I open Bash on Ubuntu on Windows, because I am too lazy to always launch it manually. To do so, I added the following little snippet at the very beginning of the ~/.bashrc file:

When Bash starts up, it will check if it has a terminal attached to stdout (the test -t 1 part) and then it executes zsh. You should try it out directly by quitting Bash and restarting Bash on Ubuntu on Windows and see how it launches zsh directly.

Customization

A plain zsh is quite boring, and there are a ton of useful things for zsh to leverage, so customization is key. A well-known repository of zsh customizations with nice defaults is Oh-My-Zsh, and it brings a cornucopia of themes, plugins and features with it. Installation is fairly easy, again. From your freshly installed and started zsh, you just issue the command that is shown at the oh-my-zsh website:

After that, you can configure your plugins (I use git and ubuntu) and themes (I use this custom one).

Update 2016/11/16: Be aware that this theme also requires ‘git’ to be installed to display branch information, so you should do a sudo apt-get install git if you did not already.

Zsh is a bit theme-happy, so you will find more than 100 of them in the default installation. To help a bit, there are some screenshots shown in the zsh wiki. Please be aware that unicode characters in zsh in Bash on Ubuntu on Windows aren’t really supported by now, so some themes may not be for you.

So, after a bit of customization, you can start to enjoy the features of zsh.

I’m afraid that is not possible.
Cmder is a console emulator for Windows, and will only run the normal Windows command shell (cmd.exe) in an environment that resembles (or emulates) how a console would work on *NIX systems.

Bash on Ubuntu on Windows however is the real Ubuntu Bash, running in a real Ubuntu installation that runs run on the Linux Subsystem for Windows (which just intercepts the kernel calls from linux and translates them to the Windows Kernel).
There is no cmd.exe, it’s just a real linux bash. And you can use that to run a real linux Zsh-

However, that has nothing to do with Cmder, as Cmder is a Windows program and not a Linux program.

I just figured out, that it is, in fact, possible to run bash (or zsh 😉 ) in Cmder.

Just create a new TASK in Cmdr (Shortcut: Win + Alt + T).
For the new Task, you can set the bash icon in the task parameters: -icon "%USERPROFILE%\AppData\Local\lxss\bash.ico"
Then, in the commands windows, enter the following:%windir%\system32\bash.exe ~ -cur_console:p

If you want ZSH to startup directory, then use this command: %windir%\system32\bash.exe ~ -c zsh -cur_console:p