The Bash shell arriving with Windows 10’s Anniversary Update is deceptive. It’s not just Bash–it’s a compatibility layer for running Linux software on Windows. You can use it to run Zsh or whatever other shell you prefer.
As of Insider Build 14342, the Zsh shell now works on Windows 10. You can have Bash automatically execute Zsh whenever you launch it. Oh My Zsh also works for customizing your Zsh shell on Windows, just as it does on Linux.
First: Install Bash
Before installing your shell of choice, you’ll first need to enable the Windows Subsystem for Linux and install Bash. This will install a complete Ubuntu user space environment on Windows, including the Bash shell.
If you’ve already installed Bash on Windows, you’re good to go.
How to Install Zsh (or Another Shell)
Once Bash is installed, you just need to install the shell you want to use from within Bash. You do this with the apt-get command, just as you’d install any other software package on Ubuntu Linux.
To install Zsh, open the Bash shell and run the following command:
sudo apt-get install zsh
Press “y” when prompted and press Enter to continue. Apt-get will automatically download and install Zsh from Ubuntu’s repositories.
If you want to use another shell, specify the name of that shell instead of Zsh. For example, people report the Fish shell also works. To install it, you’d run the following command:
sudo apt-get install fish
How to Launch Zsh (or Another Shell)
To launch Zsh or another shell after it’s installed, just type the name of the shell in the Bash prompt and press Enter. For example, to start using Zsh from Bash, you’d just type:
You’ll be prompted to go through Zsh’s first-time setup process and create a configuration profile the first time you launch it. Type “2” to create a configuration profile with the recommended default settings.
To leave the zsh shell and return to Bash, run the following command:
How to Make Bash Automatically Launch Zsh
Due to the way Microsoft implemented this feature, you can’t launch Zsh directly and bypass Bash. To start running Linux software, you need to launch a Bash window and run the software from there. However, you can have Bash automatically switch to Zsh whenever you launch it.
To do this, you’ll need to edit your .bashrc file. Bash will run the commands in this file every time it starts. You can do this using any text editor you prefer, including vi, but we’ll explain the process using nano.
To open the .bashrc file in nano, run the following command:
Add the following lines to the file. You could simply add “exec zsh”, but the following lines will ensure that Bash only launches Zsh when you open a Bash window. This will avoid causing problems for other software.
# Launch Zsh if [ -t 1 ]; then exec zsh fi
If you wanted to execute a different shell, you’d enter that shell’s command instead of “zsh”.
After you do, press Ctrl+O and then Enter to save. Press Ctrl+X to exit nano afterwards.
Now, whenever you open the Bash application on Windows, it will now start up with the Zsh shell.
To reverse your change, edit the .bashrc file again and delete the section you added.
All alternative Linux shells should work, in theory. If one doesn’t, Microsoft needs to fix the underlying Windows Subsystem for Linux so that is correctly runs more Linux software. You can view existing bugs and report new bugs to Microsoft at the BashOnWindows GitHub page.