If you’re a Windows 10 user, you’re likely using some form of shell. Shells are the programs that help you interact with your computer. They come in different flavors, but the most popular ones are Bash and Zsh. Zsh is a popular shell for Windows 10 that can be used to manage your computer’s tasks. You can use it to open files, run commands, and more. Here’s how to use Zsh in Windows 10:
- Open a new window or tab and type “zsh” into the address bar. This will open a new Zsh shell instance on your computer.
- To start Zsh, type “zsh”. This will start it up and show you the options for configuring your computer’s environment. You can choose to run this shell as an administrator or just use it as normal.
- To get started with Zsh, type “zlogin”. This will prompt you for your login name and password before starting up Zshell. If you don’t have them set up already, they’ll be generated when you first install Zshell on your computer.
- To start working with files in Zshell, type “pwd”. This will print out the current working directory (C:\Users\username\AppData\Roaming\ZSH) as well as all of the files in that directory (including subdirectories). You can also use this command to list all of the files in a directory by typing “ls”.
Ubuntu and the other Linux distributions available on Windows 10 use the Bash shell by default, but that’s not your only option. Windows has a compatibility layer for running Linux software on Windows, and you can use it to run Zsh or whatever shell you prefer.
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 in Windows, just as it does in Linux.
Start By Installing Bash
RELATED: How to Install and Use the Linux Bash Shell on Windows 10
Before installing your shell of choice, you’ll first need to enable the Windows Subsystem for Linux and install a Linux environment. We’ll be using Ubuntu as an example in this article, but you can perform a similar process on openSUSE and other Linux distributions.
If you’ve already installed Bash on Windows, you’re good to go.
How to Install Zsh (or Another Shell)
After 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 on Ubuntu, open the Bash shell and run the following command:
Press “y” when prompted, and then press Enter to continue. Apt-get automatically downloads and installs Zsh from Ubuntu’s repositories.
On other Linux distributions, just use your Linux distribution’s software installation command. For example, you’ll need to use the zypper command on openSUSE.
If you want to use another shell, specify the name of that shell instead of Zsh. For example, we’ve seen reports that the Fish shell also works well. To install it, you’d run the following command:
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 then 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, just run the following command:
How to Directly Launch Zsh
You can launch the Zsh shell directly with a command like the following:
How to Make Bash Automatically Launch Zsh
You can also have Bash automatically switch to Zsh whenever you launch it.
To do this, you need to edit your .bashrc file. Bash runs the commands in this file every time it starts. You can make the edits using any text editor you like, 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 the “exec zsh” line, but the following additional lines ensure that Bash only launches Zsh when you open a Bash window. This avoid causing problems for other software.
If you wanted to execute a different shell, you’d enter that shell’s command instead of the “zsh” command.
After you make the changes, press Ctrl+O and then Enter to save the file. Press Ctrl+X to exit nano afterwards.
Now, whenever you open the Ubuntu shortcut (or other Linux distribution shortcut) on Windows, it starts 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.