The newer wsl
command’s import/export feature can readily create copies of a distro without installing any additional tools or using RegEdit. For example
cd C:\Users\MattSlay
wsl --export Ubuntu ubuntu.tar
wsl --import UbuntuRuby .\UbuntuRuby ubuntu.tar
wsl --import UbuntuPython .\UbuntuPython ubuntu.tar
wsl --import UbuntuDotNet .\UbuntuDotNet ubuntu.tar
wsl -d UbuntuRuby
wsl -d <distro>
launches the distro. If WSL 2 has been installed, then the distro can be converted between versions during --import
using the --version
option:
wsl --import UbuntuRuby .\UbuntuRuby ubuntu.tar --version 2
A smaller distro, such as Alpine, can make experimentation much faster. Finally, wsl --import
can read from standard input -
and wsl --export
can write to standard output -
. This allows a compression program to be used to save disk space if desired.
Side note:
The default login of imported distro is root.
For Build 18980 and later, you may create or modify /etc/wsl.conf
to set your default login user instead of fiddling with registry or login with wsl -u <username>
. Reference
Content of /etc/wsl.conf. It might take effect after shutdown or logout.
[user]
default=<your-default-username>