Windows Subsystem for Linux

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

Windows Subsystem for Linux (WSL) is a compatibility layer developed by Microsoft that allows you to run the Linux kernel directly on a Windows system. This pioneering technology seamlessly integrates Linux functionality into the Windows operating system, eliminating the need for complex dual-boot configurations or resource-consuming virtual machines. This article will introduce WSL, explore its features, benefits, and how it seamlessly bridges the gap between two seemingly different operating systems.

What is Windows Subsystem for Linux?

Windows Subsystem for Linux is a lightweight layer that enables Linux distributions to work natively with Windows. It does this by using the Linux kernel, which is then translated into a Windows system call. As a result, WSL can execute Linux binaries without making any changes.

Note: Check Microsoft’s official WSL documentation and awesome community list on GitHub.

Different Versions of WSL

WSL 1, the first version of WSL, included a translation layer but did not include a complete Linux kernel. The second version, WSL 2, on the other hand, introduced significant enhancements, including the inclusion of a complete Linux kernel in a lightweight virtual machine. This upgrade improves performance, and compatibility with system calls, and enables the running of a wider range of Linux software. This makes WSL an attractive option for seamlessly integrating Linux functionality into the Windows environment. Here is a comparison table of these versions of WSL:

Feature WSL 1 WSL 2
Architecture Translation layer Lightweight virtual machine (VM)
Kernel Integration Uses a compatibility layer without a full Linux kernel. Incorporates a complete Linux kernel within a lightweight VM.
Performance Slower Faster
Docker support No Yes
Resource usage Lower Higher
System call compatibility Partial Full
Network namespace Shares Windows namespace Separate namespace
Filesystem format Different from Windows Compatible with Windows

It is recommended to use WSL 2 as it is more updated, reliable, and feature-rich.

Why Use Windows Subsystem for Linux (WSL)?

The Windows Subsystem for Linux (WSL) offers numerous compelling benefits for users who wish to use Linux tools and applications in the Windows environment. Here’s a quick overview of what WSL can do:

  1. Seamless integration with Windows.
  2. Lightweight and efficient.
  3. Native Linux support.
  4. Cross-platform compatibility.
  5. Access to a wide range of Linux distributions.
  6. Enhanced productivity for developers.
  7. Learning Linux on Windows.
  8. File sharing between Windows and Linux.
  9. Regular updates and support.
  10. Command-line and GUI applications.

Who Should Use Windows Subsystem for Linux (WSL)?

WSL is an excellent choice for developers, system administrators, and users who wish to utilize Linux tools and applications natively on Windows. Additionally, WSL is an ideal choice for users who wish to learn Linux without the need to install a standalone operating system.

How to Install Subsystem for Linux (WSL)?

To use WSL, you must install WSL first. You can install WSL using the Command Line Interface (CLI) and also using the Graphical User Interface (GUI). Check out the following ways through which you can install WSL:

Install WSL 1 Using CLI

Windows Subsystem for Linux Version 1 (WSL 1) is a Windows compatibility layer that facilitates the execution of Linux binary programs. It works by translating the Linux system calls into the corresponding Windows calls. WSL 1 does not contain a Linux kernel; rather, it is based on the translation layer. It provides access to the Linux command-line toolset but may have some restrictions, particularly regarding system call compatibility and overall performance. You need to go through the following 3 steps to install WSL 1 using the command line interface:

  1. Enable WSL in Windows
  2. Install Ubuntu in WSL
  3. Change WSL Version

To learn how to install WSL-1 using CLI follow “How to Install Ubuntu in WSL 1”.

Install WSL 2 Using CLI

Windows Subsystem for Linux (WSL) 2 is the newest version of Microsoft’s WSL with significant improvements over its previous version. The key feature of WSL 2 is the inclusion of a full Linux kernel, which transforms WSL 2 into a virtual machine-like environment. This update improves performance, improves system call support, and enables WSL 2 to run a wider variety of Linux software. Utilizing a lightweight utility virtual machine powered by Hyper-V, WSL 2 allows native Linux binaries to execute directly on Windows, seamlessly integrating Linux capabilities within the Windows environment. To install WSL 2 using the command line interface do the following steps:

  1. Enable WSL in Windows
  2. Make WSL 2 Default
  3. Install Ubuntu in WSL 2

In order to install WSL-2 using CLI go through “How to Install Ubuntu in WSL2”.

Install WSL Using GUI

Installing WSL using the GUI is not a common method, as it is typically done through the command line.  There are 3 steps to install Ubuntu in WSL Using GUI:

  1. Enable WSL in Windows
  2. Install Ubuntu in WSL
  3. Set Up Ubuntu

If you want to install WSL using the graphical user interface, follow the steps mentioned in “How to Install Ubuntu in WSL Using GUI”.

Disadvantages of WSL

While WSL (Windows Subsystem for Linux) brings Linux capabilities to the Windows environment, it does have some limitations and disadvantages:

  1. Kernel Limitations: WSL lacks some advanced Linux features due to its partial kernel.
  2. Speed Impact: Despite improvements, WSL may slow down certain operations.
  3. No Graphical Interface: It’s mainly for command-line tools; lacks full GUI support.
  4. File System Compatibility: File system translation may cause compatibility issues.
  5. Limited Systemd Support: Some Linux applications may face restrictions.

This community-driven GitHub repository provides a comprehensive list of applications that are compatible with the Windows subsystem on Linux, as well as those that are not.

Conclusion

The Windows Subsystem for Linux is a revolutionary advancement in cross-platform compatibility, allowing users to take advantage of the advantages of both Windows and Linux. Combining the power of Windows with the power of Linux, WSL unlocks new possibilities for developers, system admins, and enthusiasts. Explore this revolutionary technology and experience the best of both universes.

People Also Ask

What does Windows Subsystem for Linux do?

The Windows Subsystem for Linux (WSL) enables users to directly run Linux distributions on Windows, eliminating the need for virtualization. It provides a smooth integration with Windows, a wide range of Linux distributions, a user-friendly interface, and a user-friendly design. WSL is suitable for a variety of users, from developers to system admins to those interested in Linux.

Can I install Windows Subsystem for Linux?

Yes, you can install Windows Subsystem for Linux (WSL) on a Windows machine. But you have to fulfill the minimum requirement to install WSL.

Is WSL 2 a virtual machine?

Yes, WSL 2 (Windows Subsystem for Linux 2) operates with a lightweight utility virtual machine (VM) powered by Hyper-V. Unlike WSL 1, which used a compatibility layer to translate Linux system calls into Windows system calls, WSL 2 includes a full Linux kernel. But it is not a full-fledged virtual machine like Oracle VirtualBox or VMware Workstation Player. This means that WSL 2 is more lightweight and efficient than a traditional virtual machine, and it does not require the installation of separate drivers or software.

What are the requirements for WSL?

To run WSL (Windows Subsystem for Linux) you will need:

  1. Windows Version: WSL 1 is available on Windows 10 versions 1607 and later. WSL 2 requires a Windows 10 Version 1903 or later.
  2. 64-bit System: WSL requires a 64-bit system.
  3. Virtualization Support: If you want to use WSL 2, your system must have virtualization capabilities enabled in the BIOS/UEFI.
  4. Windows Subsystem for Linux Feature: Ensure that the WSL feature is enabled on your Windows system.
  5. Internet Connection: For downloading Linux distributions from the Microsoft Store.

Is WSL better than VirtualBox?

The choice between Windows Subsystem for Linux (WSL) and VirtualBox depends on your specific needs and preferences. WSL is ideal for Linux command-line work, bash scripting, and applications due to its productivity and smooth Windows integration. However, if you want a full Linux experience and an easy-to-use interface, VM software such as VirtualBox is better for you. VMs provide full Linux features and customization. In conclusion, WSL is suitable for lightweight work, while VMs offer a full Linux environment tailored to your needs.

How do I use a Windows file with a Linux app?

In WSL, you can conveniently access your files from both Windows and Linux apps. WSL automatically mounts your machine’s fixed drives under the /mnt/<drive> folder in your Linux distros. For instance, your C: drive is accessible at /mnt/c/. This seamless integration allows for effortless file sharing between the Windows and Linux environments within WSL.

How do I uninstall a WSL Distribution?

To uninstall a WSL distribution, open PowerShell as an administrator and use the command wsl --unregister <DistributionName>. Replace <DistributionName> with the actual name of your Linux distro, which you can find using the command wsl --list. This command removes the distribution and associated data. Additionally, you can uninstall the Linux distro app from your machine like any other Windows application.

Will WSL 1  be abandoned?

Microsoft has stated that they are concentrating on developing and enhancing WSL 2, with WSL 1 not receiving any major updates. Although it will not be completely abandoned, Microsoft recommends users transition to WSL 2 to experience improved performance, compatibility, and features. As the successor to WSL 1, WSL 2 offers a more reliable and comprehensive experience.

Can I run WSL 2 and other 3rd party virtualization tools such as VMware, or VirtualBox?

Yes, WSL 2 can be used with external virtualization solutions such as VMware and VirtualBox. The WSL 2 virtualization is based on Hyper-V. Hyper-V and WSL 2 can work together, but be careful as running them at the same time can cause problems like Blue Screen of Death (BSOD), VM startup issues, and performance issues.

Can I access the GPU in WSL 2?

Yes, WSL 2 supports GPU access through DirectML. This means that some applications such as Machine Learning, Artificial Intelligence, and Data Science tasks within the WSL 2 distribution can take advantage of GPU acceleration for better performance. However, it is important to note that WSL 2 does not support all GPU features. The level of support varies depending on the GPU and the driver. For the most up-to-date information on WSL 2 GPU access, please refer to Microsoft documentation.

Related Articles


<< Go Back to Linux OS Single InstallationLearn Linux Basics

5/5 - (5 votes)
Ridoy Chandra Shil

Hello everyone. I am Ridoy Chandra Shil, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Biomedical Engineering graduate from Bangladesh University of Engineering and Technology. I am a science and tech enthusiast. In my free time, I read articles about new tech and watch documentaries on science-related topics. I am also a big fan of “The Big Bang Theory”. Read Full Bio

Leave a Comment