How to use Zsh (or other Shells) on Windows 10?

Bash Shell is integrated into Windows 10 Anniversary Update version is just a compatible class to run Linux software on Windows operating system. You can use the Bash shell to run Zsh or any shell you want.

Bash Shell is integrated into Windows 10 Anniversary Update version is just a compatible class to run Linux software on Windows operating system. You can use the Bash shell to run Zsh or any shell you want.

Since Insider Build 14342, Zsh shell has been running on Windows 10. You can set Bash to automatically execute Zsh every time Bash starts.

Zsh is a shell program designed to interact, and Zsh is also a powerful scripting language. Zsh integrates many useful features of both bash, ksh and tcsh, and offers many other features.

How to use Zsh (or other Shells) on Windows 10? Picture 1How to use Zsh (or other Shells) on Windows 10? Picture 1

1. Install Bash

Before installing the Shell of your choice, the first thing you need to do is activate Windows subsystem for Linux and install Bash.

This process will install the Ubuntu user space environment on Windows, including the Bash shell.

How to use Zsh (or other Shells) on Windows 10? Picture 2How to use Zsh (or other Shells) on Windows 10? Picture 2

2. How to install Zsh (or other shell)?

After installing Bash, you just need to install the Shell you want to use in Bash. To do this, use apt-get, just like when you install any package on Ubuntu Linix.

To install Zsh, open the Bash shell and run the command:

sudo apt-get install zsh

Press "y" when asked and press Enter to continue. Apt-get will automatically download and install Zsh from repositories of Ubuntu.

How to use Zsh (or other Shells) on Windows 10? Picture 3How to use Zsh (or other Shells) on Windows 10? Picture 3

If you want to use another Shell, just specify the Shell name instead of writing Zsh. For example, if you want to install Fish shell, run the following command:

sudo apt-get install fish

3. How to open Zsh (or other Shell)?

To open Zsh or other shells after installation is complete, simply enter the shell name in the Bash command prompt (Bash prompt) and press Enter. For example, to start using Zsh from Bash, you just need to enter:

Zsh

You will be prompted to set up the first Zsh process and create a configuration profile the first time you open Zsh. Enter "2" to create a configuration profile containing default settings.

How to use Zsh (or other Shells) on Windows 10? Picture 4How to use Zsh (or other Shells) on Windows 10? Picture 4

To remove the zsh shell and return to Bash, run the following command:

exit

4. How does Bash automatically run Zsh?

Because of the way Microsoft executes this feature, you cannot open Zsh directly and bypass Bash. To run any Linux software, you must open the Bash window and run the software there. However, you can set Bash to automatically convert to Zsh whenever you open.

To do this you have to edit the .bashrc file. Bash will run the command in this file every time it starts. To open the .bashrc file in nano, run the following command:

nano .bashrc

How to use Zsh (or other Shells) on Windows 10? Picture 5How to use Zsh (or other Shells) on Windows 10? Picture 5

Add the following lines to the file. You can only add "exec zsh", but the following commands will ensure Bash only opens Zsh when you open the Bash window. This is to avoid causing problems with other software:

# Launch Zsh

if [-t 1]; then

exec zsh

fi

If you want to execute another shell, you only need to replace "zsh" with that shell command.

How to use Zsh (or other Shells) on Windows 10? Picture 6How to use Zsh (or other Shells) on Windows 10? Picture 6

Once done, press Ctrl + O and press Enter to save the changes. Press Ctrl + X to exit nano.

From now on whenever you open the Bash application on Windows, it will automatically open Zsh shell.

If you want to change to the original state, follow the same steps, edit the .bashrc file again and delete the parts you added.

Refer to some of the following articles:

  1. Learn the file system and folders on Linux operating systems
  1. Clear the Dropbox cache Windows and Linux to free up memory space
  1. Certain deadly commands never run on Linux

Good luck!

4 ★ | 1 Vote