Skip to content

Instantly share code, notes, and snippets.

@cedrickring

cedrickring/README.md

Last active Dec 20, 2018
Embed
What would you like to do?
Use zsh instead of bash in WSL

Use zsh instead of bash in WSL

Prerequisites

First of all, you need to install your favorite Windows Subsystem for Linux flavor.
For installation steps, see here

Install zsh

To install zsh, you should follow the steps described here.
I'd recommend installing Oh My Zsh too, since it's a great extension for zsh.

Configure WSL to use zsh instead of bash

  1. After installing zsh, run chsh -s $(which zsh) to switch from bash to zsh
  2. Open the .zshrc in your preferred editor and add cd ~ as the first line
  3. I'd recommend adding symlinks from /mnt/c/Users/<your-username> to ~/<your-username>
    ln -s /mnt/c/Users/<your-username> ~/<your-username>
    
  4. Make sure to use wsl.exe and not bash.exe when opening the WSL terminal again

Configure Hyper.js

For those of you who would like to have a nicer terminal experience than the default Windows command line can install Hyper.

To use Hyper with WSL, you just have to change the shell path in the ~/.hyper.js configuration file

{
    shell: 'C:\\Windows\\System32\\wsl.exe',
    shellArgs: []
}

Configure VSCode

If you'd like to have the WSL terminal in VSCode you can add the following line to your user settings:

"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\wsl.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment