The Windows Subsystem for Linux (WSL) allows users to experience the Linux system under Windows. This article covers the differences between WSL versions, installation and use of WSL2, and terminal tools for Windows.
WSL1 differs from WSL2
WSL2 is a big change from WSL1. It uses virtualization technology and has a full Linux kernel, so it has all the Linux system calls. WSL1 essentially translates Linux instruction calls into Windows instructions.
However, Windows and Linux access to each other’s file systems will be much slower under WSL2 because of the network protocol. However, according to Microsoft, the IO speed of the WSL2 Linux subsystem accessing files on the system is much faster than that of WSL1.
Architecture diagram
The difference
Feature | WSL 1 | WSL 2 |
---|---|---|
Integration between Windows and Linux | ✅ | ✅ |
Fast boot times | ✅ | ✅ |
Small resource foot print compared to traditional Virtual Machines | ✅ | ✅ |
Runs with current versions of VMware and VirtualBox | ✅ | ✅ |
Managed VM | ❌ | ✅ |
Full Linux Kernel | ❌ | ✅ |
Full system call compatibility | ❌ | ✅ |
Performance across OS file systems | ✅ | ❌ |
The installation
Enable the WSL function
Open Powershell as an administrator and type the following command
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Check the required system version of WSL2
Win + r Enter winver to view the system version version Requirements X64: the version is later than 1903 (the internal OS version is later than 18362)
Enable the VM function
To start Powershell as an administrator, type the following command
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Download the Linux kernel update package
After downloading, double-click install, click yes to give the corresponding permission
Set WSL2 to the default WSL version
Open Powershell as an administrator and type the following command
wsl --set-default-version 2
If that fails, restart the computer and try again
Install your favorite Linux distribution
This is ubuntu 18.04 LTS
Currently supported distributions
- Ubuntu 16.04 LTS
- Ubuntu 18.04 LTS
- Ubuntu 20.04 LTS
- Packages Leap of 15.1
- SUSE Linux Enterprise Server 12 SP5
- SUSE Linux Enterprise Server 15 SP1
- Kali Linux
- Debian GNU/Linux
- Fedora Remix for WSL
- Pengwin
- Pengwin Enterprise
- Alpine WSL
Start, set necessary information (such as account, password, etc.) as prompted
Windows Terminal
Windows Terminal is a Terminal tool developed by Microsoft. It is equivalent to the Terminal in Linux. It is much easier to use than the CMD and Powershell of Windows, and has built-in WSL support.
The installation
Just search the Microsoft Store for the installation. There are stable versions (Windows Terminal) and Development versions (Windows Terminal Preview), depending on the situation.
Some configuration
Set Default to WSL and the startup directory to the user directory under home
Set Default to the Default startup profile
Windows and Linux file access
Win Quick access to Linux folders
Type \\ WSL $in the file Explorer address bar to access all installed Linux distribution directories. Right click map Network drive for quick follow-up access
Linux access the Win folder
In Linux, the/MNT directory is the Win folder. You can access Win file resources through this directory
ref
- Comparing WSL 1 and WSL 2
- What is the difference between WSL 1 and WSL 2
- Windows Subsystem for Linux Installation Guide for Windows 10
- Use guide
- Windows10 ubuntu subsystem WSL file location