WSL stands for “Window Subsystem for Linux”, enabling the features of Linux on the Windows operating system. Two common WSL versions, WSL1 and WSL2, are designed by Microsoft Corporation for Linux users. Both of these versions are supported to perform basic Linux functionalities. This post will enlist the possible methods to check the WSL version on Linux.
The supported content of this article is as follows:
- Prerequisites: How to Install the WSL?
- How to Check WSL Distributions?
- How to Check the Installed WSL Version?
- How to Set Default WSL Version?
- How to Specify WSL Version For Linux Distribution?
Prerequisites: How to Install the WSL?
WSL is the kernel layer on which Linux binaries are executed over the Windows operating system. To install the latest version of WSL, follow the below steps:
Step 1: Open the Command Prompt
In the Window operating system, open the command prompt through the search bar as the “Run as administrator” option:
Step 2: Install WSL
To install the WSL latest version on the Window Operating system, run the below-mentioned command:
> wsl --install
After downloading and installing the required kernel files, a message is displayed “WSL Kernel has been installed”.
How to Check WSL Distributions?
After rebooting the system, open the command prompt window using the administrator’s privilege. After that, execute the below script to check the WSL Distributions installed in the current operating system:
> wsl -l
The output ensures that “Ubuntu” has been installed in the current system.
How to Check the Installed WSL Version?
You can check the WSL version, which is installed in Windows operating system, by executing the below script:
> wsl -l -v
An alternate command provided below can also be used to check the WSL version:
> wsl --list --verbose
How to Set Default WSL Version?
The WSL command provides the “set-default-version” utility to set the default WSL version. For instance, the command provided below will set the default version of the WSL to 2:
> wsl --set-default-version 2
How to Specify WSL Version For Linux Distribution?
You can also specify the WSL version using the “wsl –set-version [dist_name] [wsl_ver]” command to a specific Linux distribution. For instance, the command provided below will set the WSL version 1 for Ubuntu:
> wsl - - set-version Ubuntu 1
Similarly, to switch the WSL version from WSL1 to WSL2, use the command as shown below:
> wsl --set-version Ubuntu 2
The message “Conversion complete” verifies that WSL1 has successfully switched to WSL2.
To check the current version of WSL, the “wsl –list –verbose” or “wsl -l -v” command is utilized in the Windows Command Prompt. WSL is quite beneficial for Linux users to utilize the functionality of the Linux system on Windows. Additionally, users can switch WSL versions by following the syntax “wsl –set-version <version>” to set a specific WSL version for the Linux system. This guide has explained various methods to check the wsl version in the Window terminal.