Common WSL Commands
wsl --list / wsl -l:list distributions
wsl --list --running:list running distributions
wsl --distribution <<distro-name-here>>: start distribution and enter shell as default user
wsl --shutdown: shutdown all distributions and the WSL management vm
wsl --help | more: show WSL Help
Remove Distro (but not uninstall WSL)
wsl --unregister <distro name>
Also consider uninstalling from the Microsoft Store in addition to the above.
Multiples of the same distro
From: https://superuser.com/questions/1816644/can-we-have-multiple-wsl2-distros-of-the-same-type-installed-in-a-single-windows
Based off: https://endjin.com/blog/2021/11/setting-up-multiple-wsl-distribution-instances
Here is how to have several copies of the same distribution:
- Install the base distribution from the Windows Store or using:
wsl --install -d <distribution name> - Log into the environment and modify as needed, then exit it
- Export the environment with the following command:
wsl --export <distribution name> <export file name> - Create a new instance of the base environment by importing the .tar file:
wsl --import <new distribution name> <install location> <export file name> - You may now open the new environment using:
wsl -d <new distribution name> - In Windows 11, you can browse the file-system of distributions in Explorer via Desktop > Linux
-
The new distribution will have root as the default user. To login as another user, either use the
-u <username>flag or create/modify awsl.conffile in/etcdirectory inside the environment, with the following section:[user] default=<username>