To set your default Windows Subsystem for Linux (WSL) distribution, get the Linux distro name by running wsl -l -v
, then run wsl -s
to set the new default WSL distro.
This post shows a demo of setting the default WSL Linux distribution on a Windows computer. This is useful if you have more than one WSL distro installed and you’re managing multiple Windows WSL environments.
There are 2 parts to this guide:
# Check Installed WSL Distros
# Set Default WSL Distro
Check Installed WSL Distros
To view your currently installed WSL Linux distributions on your Windows computer, run the following WSL command:
# Check installed WSL distros wsl -l -v
The star at the distro name indicates the current default Linux distribution. If we enter back into WSL by running wsl
on its own, we will open the default WSL distro, Ubunutu 20.04 in this case.
Change Default WSL Distro
To set the default Linux distro in Windows Subsystem for Linux, run wsl -s <distribution-name>
in a PowerShell Terminal. You should get the Linux distribution name for this command from the WSL list command displayed above in this post.
# change default linux distro in windows subsystem wsl -s <distro_name>
We have now set the default WSL distribution to WSL2 Debian. This won’t interrupt an active WSL terminal session if you have one open.
The screenshot below displays running the WSL command to enter the default WSL distro, and I’m running a few test commands within Debian WSL Edition to verify which Linux version this is.
That’s covered for setting your default WSL distro on the Windows Subsystem. Check out my WSL Windows Tips page for similar WSL administration guides.
Comments
One response to “How to Set Default WSL Distribution”
[…] Lastly, I’m now exiting (‘exit’ command) out of WSL, listing out my Linux distros and setting this Ubuntu 20.04 distro as my default. […]