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.
“wsl”
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.
“bash”
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:
-c [command] - bash -c [command]
- 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.
Thanks a lot,
wsl [command] – this command helped me a lot.
Strange why it is not described in program(wsl –help)..