Windows Subsystem for Linux 2 Is Now Out for Insiders – Promises to Bring An “Amazing Linux Experience on Windows”
As reported last night, Microsoft finally introduced Windows Subsystem for Linux 2 through its Windows 10 20H1 Preview Build. WSL enables users to run Linux binary executables natively on their Windows machines. The new version, WSL2, changes the game by using a real Linux kernel.
The Linux kernel in WSL 2 is built in house from the latest stable branch, based on the source available at kernel.org. This kernel has been specially tuned for WSL 2. It has been optimized for size and performance to give an amazing Linux experience on Windows and will be serviced through Windows updates, which means you will get the latest security fixes and kernel improvements without needing to manage it yourself.
Using a real Linux kernel, WSL 2 makes things way faster than before. The company said that it's aiming to make WSL 2 work exactly like the first version, just with added performance. "Each Linux distro can run as a WSL 1, or a WSL 2 distro and can be switched between at any time," Microsoft writes.
— Craig Loewen (@craigaloewen) June 12, 2019
Microsoft’s Windows 10 leader, Dona Sarkar, wrote in the release notes of last night's Preview Build that "WSL 2 delivers a much faster file system performance and full system call compatibility, which lets you run more applications like Docker!"
With WSL 2, Microsoft has also added some new commands to help you control and view your WSL versions and distros. These include:
wsl --set-version <Distro> <Version>
Use this command to convert a distro to use the WSL 2 architecture or use the WSL 1 architecture.
: the specific Linux distro (e.g. “Ubuntu”)
: 1 or 2 (for WSL 1 or 2)
wsl --set-default-version <Version>
Changes the default install version (WSL 1 or 2) for new distributions.
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 --list --quiet
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 --verbose
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.
Windows Insiders signed up with the Fast ring can begin testing WSL 2 by installing the latest Windows 10 20H1 Preview Build 18917. More details on how to install and run WSL 2 can be found here. For tips, head over to this official blog post introducing the new Windows Subsystem for Linux 2.