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.
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.
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.
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.
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.
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
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.
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:
- Learn the file system and folders on Linux operating systems
- Clear the Dropbox cache Windows and Linux to free up memory space
- Certain deadly commands never run on Linux
Good luck!
You should read it
- Ubuntu Bash tutorial on Windows 10
- Everything you can do with the new Windows 10 Bash Shell
- Running Linux on Windows 10 does not require a virtual machine, here are 18 things you should know
- 7 ways to run Linux software on Windows
- Run Windows applications on Linux, macOS and other platforms
- How to Install and Run Bash on Windows 11
- How to run Windows applications on Linux with Vineyard
- How to run Windows applications on Linux with Wine
- What is 'Bash' in Linux?
- Convert data, applications from Windows to Linux in minutes
- Instructions for installing Kali Linux on Windows 10 are easier than ever
- How to Run Linux GUI Applications with WSL2 on Windows