Skip to content

Instantly share code, notes, and snippets.

@leodutra
Last active August 19, 2021 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leodutra/6129e8aaac7d26d252aed38f3a7231a8 to your computer and use it in GitHub Desktop.
Save leodutra/6129e8aaac7d26d252aed38f3a7231a8 to your computer and use it in GitHub Desktop.
Enable Windows Subsystem Linux 2 ( WSL 2 )
# AS ADMIN
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
# Use this command to convert a distro to use the WSL 2 architecture or use the WSL 1 architecture.
# <Distro>: the specific Linux distro (e.g. “Ubuntu”)
# <Version>: 1 or 2 (for WSL 1 or 2)
# wsl --set-version <Distro> <Version>
# Changes the default install version (WSL 1 or 2) for new distributions.
# wsl --set-default-version 2
# Only list the distribution names.
# This command is useful for scripting since it will only output the names of distributions you have installed without showing other information like the default distro, versions, etc.
# wsl --list --quiet
# Shows detailed information about all the distributions.
# This command lists the name of each distro, what state the distro is in, and what version it is running. It also shows which distributions is default with an asterisk.
# wsl --list --verbose
# Immediately terminates all running distributions and the WSL 2 lightweight utility virtual machine.
# The VM that powers WSL 2 distros is something that we aim to manage entirely for you, and so we spin it up when you need it and shut it down when you don’t. There could be cases where you would want to shut it down manually, and this command lets you do that by terminating all distributions and shutting down the WSL 2 VM.
# wsl --shutdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment