WSL2 with Windows Terminal

Windows has finally created a developer command line experience that can compete with OS X and bare metal Linux with the release of WSL2 combined with the new Windows Terminal. For WSL2 installion and updates, refer to the official Windows Subsystem for Linux Documentation.

Free your mind of an inferior Windows developer experience and make the jump

The following has been tested on Windows 10 build 19041 with WSL2 enabled and set as the default version.

Windows Terminal

One of the things I really like about the new Windows Terminal is the cut, copy and paste keybindings. No more Ctrl+Shift needed, just use Ctrl+V to paste. For example, here are some snippets from my terminal settings.json.


// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": true,

// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,

// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
//   and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit
  "defaults": {
    // Put settings here that you want to apply to all profiles.
    "fontSize": 11


// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit
    // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
    // These two lines additionally bind them to Ctrl+C and Ctrl+V.
    // To learn more about selection, visit
    { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
    { "command": "paste", "keys": "ctrl+v" },

    // Press Ctrl+Shift+F to open the search box
    { "command": "find", "keys": "ctrl+shift+f" },

    // Press Alt+Shift+D to open a new pane.
    // - "split": "auto" makes this pane open in the direction that provides the most surface area.
    // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
    // To learn more about panes, visit
    { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }

Oh My Zsh

One of the first things I do when setting up a new bash shell is install zsh and Oh My Zsh.

If you’re an npm user, I recommend installing nvm as an Oh My ZSH! custom plugin by cloning zsh-nvm into your custom plugins repo as follows:

cd ~/.oh-my-zsh/custom/plugins

git clone

Then load as a plugin in your ~/.zshrc profile. Note that plugins need to be added before is sourced.


# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.

source $ZSH/

WSL windows terminal example oh-my-zsh

Additionally, if you’re using Java and Maven, you can install and run those from WSL2 to build projects even if they exist on the mounted native Windows file system.

For example, I use SDKMAN! to manage mutiple JDK versions similar to how I manage multiple node versions using nvm.

WSL windows terminal example of mvn –version


WSL Ubuntu Files in Windows Explorer

Access your WSL files in Explorer by entering network path \\wsl$ in the address bar.

Windows Localhost Resolver

For WSL2 Linux: The script gets the IP from the /etc/resolv.conf file and updates /etc/hosts. A use case for this is when you want to target localhost on Windows from Linux on WSL2.

Adding Cygwin and Git Bash to Windows Terminal

If you want the benefits Windows Terminal offers such as copy on selection and Ctrl+V paste when using Cygwin and/or Git Bash, add them to the profiles list. Use PowerShell to generate the GUID for each. e.g.,


Update the profiles list using a new unique GUID for each in settings.json, for example,


  "profiles": {
    "defaults": {
      // Put settings here that you want to apply to all profiles.
      "fontSize": 10,
      "useAcrylic": true,
      "acrylicOpacity": 0.5
    "list": [
        "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
        "hidden": false,
        "name": "Ubuntu-20.04",
        "source": "Windows.Terminal.Wsl"
        "guid": "{6a75c3e0-7375-45ea-9e31-8edb7d5cec33}",
        "name": "Git Bash",
        "commandline": "C:\\Program Files\\Git\\bin\\bash.exe",
        "icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
        "closeOnExit": true,
        "historySize": 9001,
        "startingDirectory": "%USERPROFILE%",
        "hidden": false
        "guid": "{7207cbc3-9406-44ed-83a5-b037a3e6075d}",
        "name": "Cygwin",
        "commandline": "C:\\cygwin64\\bin\\bash.exe --login -i",
        "icon": "C:\\cygwin64\\Cygwin-Terminal.ico",
        "closeOnExit": true,
        "historySize": 9001,
        "hidden": false



Save the settings and relaunch your Windows Terminal app, you should see the updates when selecting the New Tab drop down.

Windows Terminal Tabs with Cygwin and Git Bash Profiles

Cygwin Oh My Zsh

For Cygwin running in the Windows Terminal, we need zsh to start, which is required for Oh My Zsh, create a .profile file in the user home ~/ directory. Verify using ls -a to list files including those that are hidden such as .bashrc, .profile and .zshrc, etc.

Then add /bin/zsh to the .profile to run zsh.exe when Cygwin bash is started as a login shell.


.profile is executed when bash is started as login shell, e.g. from the command bash --login. .bashrc is similar to .profile, but is executed each time an interactive bash shell is launched.


comments powered by Disqus