wsl
Windows Subsytem Linux
Practical Windows Subsystem for Linux (WSL) reference covering installation, listing and managing Linux distributions, switching WSL versions, mounting disks, updates, shutdown, and common command-line usage
Enable required settings
Enable Windows Subsystem Linux and Reboot
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
shutdown /r /t 0
Once booted up verify CPU virtualization support
systeminfo | findstr /i "virtualization"
Examples
If the Microsoft Store is inaccessible within your organization, you can still utilize this WSL version by appending --web-download to the --update command, such as wsl --update --web-download. You need to manually update WSL every time a new release becomes available using this method.
wsl --update --web-download
List available distros builtin
wsl --list --online
Unregister distro
wsl --unregister Ubuntu
Install linux distro
wsl --install Ubuntu
wsl --update
Uninstall distro
wsl --uninstall Ubuntu
To run a specific wsl distribution from within PowerShell without changing your default distribution, use the command
wsl.exe --distribution <DistroName>
Show status of current installed distros
wsl --status Ubuntu
Check wich version of WSL you got installed
wsl --list --verbose
Set default version of wsl to wsl 1 or wsl 2
wsl --set-default-version <1|2>
To set the default linux distro used
wsl --set-default <distro>
Start wsl in user home directory
wsl ~
Run a specifik linux distro from powershell
wsl --distribution --user <username>
Update wsl
wsl --update
Shutdown wsl
wsl --shutdown
Terminate wsl
wsl --terminate <distro>
Unregister a distro from wsl
wsl --unregister <distro>
Mount a disk or device
wsl --mount <DiskPath>
Unmount disks
wsl --unmount <diskpath>
Resource(s)