This post is a guide on how to change a WSL distribution, from your default WSL Linux distro in the Windows Subsystem for Linux This is useful when you are managing multiple WSL distros on your computer.
List Installed WSL Distros
First up, we want to display your installed WSL distributions and versions by running the following command.
# show installed wsl distros & versions wsl -l -v
The star at the distro name indicates the current default WSL Linux distribution.
When we enter WSL by running the
wsl command, we will log into the Ubuntu-20.04 distro.
We can run
lsb_release -a as above to verify which Linux distribution we are using.
Set Default WSL Linux Distro
To set the default WSL Linux distro we need to run
wsl -s <wsl-distribution-name>
Before running this command, the WSL distro name is as-per what is shown in the
wsl -l -v command.
# wsl show versions wsl -l -v # set default wsl distribution (as per 'wsl -l' name) wsl -s <wsl-distribution-name>
Noticing here the same ‘
lsb_release -a‘ command does not work for me when in the Debian distro – using
cat /etc/os-release instead.
That’s it for this one and is all you should need to know on changing your default WSL distribution. For more WSL Admin tips, check out some of my other WSL Blog posts:
# How to Reboot WSL (Windows Subsystem for Linux)
# How to Upgrade WSL from Version 1 to Version 2
# How to Check WSL Versions