A Guide to Invoking WSL

There are a variety of ways to invoke the Windows Subsystem for Linux from Windows commandlines and they all behave a little differently. Let’s get to the bottom of it.



The first (and recommended!) method will start up your default distro. Additionally, it starts the distro in the current working directory where you invoke the command. You can change the default distro by using the “wslconfig” tool.

In the example below, we’ll launch into the default distro (Ubuntu) in the current working directory. Then we’ll exit and change our default distro to SUSE.



Alternatively, you can specify by name the exact distro you want to launch. We now have several distros in the store and there might be cases where you wish to launch a distro which is not labeled as your default. Using Ubuntu as the example, it’s as simple as calling “ubuntu”. This will launch into the distro userland with default shell.



This will attempt to start bash in your default distro. Even if you’ve configured the distro to have another default shell (take zsh for example), it will still try to launch bash.


Executing a Command

For each method, you can append a command that you’d like to execute in the terminal. That is:

  1. <distroname> -c [command]
  2. bash -c [command]
  3. wsl [command] (NOTE: In this case you don't append '-c', you just type in your command)

You can learn more about multi distro management by checking out the documentation.

Comments (3)

  1. John Doe says:

    4. run [command]
    The difference from 1 is when include space in the command.
    -c “cat /etc/os-release”
    run cat /etc/os-release

    1. Hey John, ‘-c’, ‘run’, and ,’/c’ are all aliases which execute identically. In your example, you can execute both without the quotations with -c appended and you’ll get the same result.

  2. Ryan Erwin says:

    Does the WSL “options” command support any other flags? There is no help when running: Ubuntu config help

    Right now, I see that –default-user is the only option listed in Ubuntu /? but are there any other options?
    For example, –default-shell would be good

    Also, would be nice if this could do a get and set…
    –default-user = proposed get default user
    –default-user = current set default user function

    Interesting that the new /bin/wslpath binary is actually part of init — ie, part of the WSL kernel… Would also be nice to have more documentation on that and any other WSL nuances.

Skip to main content