So, what is WSL? WSL is a kernel compatibility layer to run Linux binaries on Windows. WSL converts the Linux calls into windows calls and executes them, though WSL 2 has its own specifically designed kernel that no longer needed call system translation. After enabling WSL in Windows and installing Linux distribution, you can use bash shell for all compatible utilities. It is quite helpful for developers and even for students who are interested to learn Linux on Windows.
WLS 2 is the successor of WSL 1, which comes with many new features, for example, an increase in performance and whole system call compatibility. Microsoft itself designed Linux kernel to optimize it for WSL 2, which allows running tons of new applications, and any future updates for Linux will immediately be available to use. To utilize the new features of WSL and gaining full system call compatibility, you must be aware of your WSL version. Whether your system needs an update or it already supports WSL 2, how do you know the version of WSL on your system? This guide is focusing on methods to check the WSL version on your system. So, let’s begin:
How to check the WSL version:
If you are using any version of Windows 10, then you have the support of WSL. Since many new features do not work in the older version of WSL, we need to update it to the latest version. There are few methods to recognize if your system supports WSL 2 or not. First of all, check the Windows 10 version and to check it, open the command prompt and type “ver”:
The version can also be checked by typing “System Information” in the Windows search bar:
If the build number is lower than “18917”, then you will have WSL 1 in your system. For example, in the above output, the build is “15063,” which means that PC has WSL 1.
If the build number is higher than “18917”, then your system supports WSL 2. To ensure that WSL 2 is enabled in your system, open the Windows command prompt and run the below-mentioned command:
Or:
Note that the above command only works on Windows build version “18362” and higher. If the output indicates the WSL version properly, that means WSL 2 is enabled in your system:
If you don’t get the above output, then use the following command to enable WSL 2:
If your system has problems with the above command, uninstall the Linux distribution from your system and run the update command again. After that, go to the Windows Store and install Linux distribution.
Though WSL 2 is the latest version, there are still some features that are only supported by WSL 1, such as quick access to files stored on Windows, serial port support, etc. So to set a specific version of WSL to a specific distribution, use the command:
Replace the “[distro_name]” with the Linux distribution name and mentioned the WSL version in the place of “[wsl_version_number].”
Conclusion:
WSL is a Windows feature that allows Windows 10 users to run Linux on Windows 10 natively. There are two main versions of WSL; WSL 2 is the updated version of WSL 1 and supports all system calls, and 20% faster than its predecessor. Although the WSL 2 is the current and overhauled version, some exceptions might make you use WSL 1. Which version you should use is a personal choice, but I would recommend going with WSL 2 because it is efficient and allows you to install Linux updates easily.