Running Windows 10 Ubuntu Bash in Cmder

“Can you run Bash in Cmder?” – In the comments of my last post (install and run (Oh-my-) zsh on Bash on Ubuntu on Windows), I was asked whether it would be possible to run the Bash (or Zsh) also in Cmder. First I thought it was not possible, but then I got curious. After digging in a bit more it turned out that it IS, in fact, possible. And it’s not difficult too.

So, since I figured out how it works, I also want to show you how you can run the Windows 10 Ubuntu Bash (and/or Zsh) in Cmder.

What is Cmder?

Cmder is a console emulator for Windows. It is my preferred way to use the Windows console (cmd.exe) for the last years, as it allows me to use *NIX commands like ls, less, grep and the like. For me, Cmder is a much nicer overall experience on the command line in Windows, and it makes me much more productive.

Screenshot of Cmder console

Cmder allows me to open multiple tabs and multiple shells at once. I can open a normal cmd.exe shell, a second one that also executed the VsDevCmd.bat file to provide access to msbuild, csc etc., a third one with powershell and, if set up correctly, also one with Bash and/or Zsh.


Actually, you just need Bash on Ubuntu on Windows enabled and, of course Cmder. If you don’t have that, you can simply follow these instructions:

Set up Bash in Cmder

First, in Cmder, you press Win + Alt + T to open up the settings dialog for Tasks. Alternatively you can open up the hamburger menu on the bottom right of the window and navigate to Settings -> Startup -> Tasks.

Step 1: You create a new Task by clicking on the ‘+‘ Button at the bottom and enter the details.

Setup Bash in Cmder
Steps for setting up Bash in Cmder

Step 2: The first input field of the dialog is the task name. I named it ‘bash::ubuntu‘ but the naming is completely up to you. You can use double colons for grouping, so this would be the ‘Ubuntu‘ task in the ‘Bash‘ group. Cmder already comes with a ‘Bash‘ group containing entries for Bash on mintty (using Cygwin) and another one based on on git-for-windows. To distinguish between the other Bashes and the ‘real’ Ubuntu thing, I simply chose to also opt into this naming scheme.

Step 3: In the “Task parameters” input you can configure an icon (I just picked the Ubuntu Bash icon): /icon "%USERPROFILE%\AppData\Local\lxss\bash.ico"

Step 4: In the “Commands” input field, you enter the command that this task should start. This is the actual call to Bash: %windir%\system32\bash.exe ~ -cur_console:p

This will start bash.exe in the current user directory (~), and also sets the cursor console mode of ConEmu, which works behind the scenes in Cmder, to allow for correct cursor movement with the arrow keys.

You can find further details on how to set up Tasks in Cmder (actually, in ConEmu) in the ConEmu documentation about tasks.

This task now will start the Bash on Ubuntu on Windows within Cmder, with all the settings you did in your .bashrc file.

Set up Zsh in Cmder

If you did not set up your Bash to automatically launch Zsh from your .bashrc file like I showed in the other blog post, you can add another task for this.

I called this new task ‘zsh::ubuntu’, but again the naming is up to you. I used the same task parameters as for the Bash task and just added -c zsh to the command entry. This will cause Bash.exe to start Zsh automatically.

The full line is: %windir%\system32\bash.exe ~ -c zsh -cur_console:p

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:

# if running in terminal...
if test -t 1; then
# ...start zsh
exec zsh

See it here in context:

Image of changes in .bashrc in context
Changes in .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.


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:

sh -c "$(curl -fsSL"

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.

An example of globbing, in zsh on Bash on Ubuntu on Windows
An example of globbing, in zsh on Bash on Ubuntu on Windows

Further reading

If you are more interested in Mac and OS X mac OS, here is a great post from one of my co-workers: Thorsten Hans: Setting up iterm2 with oh-my-zsh and powerline on OS X.

Also a great post on the features of zsh (including globbing!) is this one: David Fendrich: No, Really. Use Zsh.

And if you already seek for a far more deeper experience, then you can dive into this: Jerome Dalbert: Migrate from oh-my-zsh to prezto.

Update 2016/11/16:

Fixed in article: OS X is now mac OS.

In response to Michals question (thanks!), I blogged about how you can run Bash (or Zsh) in you can run Bash (or Zsh) in Cmder