The Windows Subsystem for Linux (WSL) is a technology that allows you to run Linux applications, command-line tools and scripts directly on the Windows operating system without the need for a traditional virtual machine or dual boot. With WSL, developers can choose their favorite Linux distribution from the Microsoft Store and use the full functionality offered by Linux systems on the Windows desktop.
Why is WSL useful?
WSL offers many benefits for Windows users and developers who want to use or create Linux systems or applications. Some examples:
- WSL allows you to run Linux commands directly from the Windows command line or PowerShell, such as
grep
,sed
,awk
or other ELF-64 binaries. - With WSL, you can run Bash scripts and Linux command-line applications on Windows, including various programming languages (NodeJS, Javascript, Python, Ruby, C/C++, C# & F#, Rust, Go, etc.), databases (SSHD, MySQL, Apache, lighttpd, MongoDB, PostgreSQL, etc.) and tools (vim, emacs, tmux, etc.).
- WSL allows you to install additional software using the package manager of your Linux distribution.
- WSL allows you to call Windows applications from a Unix-like command line.
- WSL allows you to run Linux graphical applications integrated into the Windows desktop environment.
- WSL leverages GPU acceleration for machine learning, data science and other scenarios.
Linux installation in Windows
If you want to run Ubuntu Linux in a WSL environment, the easiest way is to install it from the Microsoft Store. To do this, you need to complete the following steps:
- Enable WSL on Windows if you have not already done so. To do this, run as administrator in the PowerShell or Windows Command Prompt window the
wsl --install
and reboot the machine. - Open the Microsoft Store app and search for Ubuntu. Select the version of Ubuntu you want, for example Ubuntu 22.04.2 LTS.
- Click on the Get button and wait for Ubuntu to download and install2
- You can then start Ubuntu by using the ubuntu2204 command in PowerShell or Windows Command Prompt window, or by clicking on the Ubuntu 22.04.2 LTS tile in the Start menu
What is WSL 2?
WSL 2 is a new version of the WSL architecture that uses a real Linux kernel to run ELF64 Linux binaries on Windows. The main goals of WSL 2 are to increase file system performance and to provide full system call compatibility. This new architecture changes the way Linux binaries communicate with Windows and the computer hardware, but provides the same user experience as WSL 1 (the version that is currently widely available).
The benefits of WSL 2 include faster startup, better memory management, support for Docker and other container technologies, and the ability to customize and update the Linux kernel. The disadvantages of WSL 2 include that it is less integrated with the Windows file system and network, and that some security software may interfere with its operation.
It is possible to switch between WSL 1 and WSL 2 at any time, and to run different Linux distributions with both architectures at the same time. To change the WSL version, you can use the wsl --set-version
command.
TL:DR (in short)
The Windows Subsystem for Linux is a great option for Windows users and developers who want to use or create Linux systems or applications. WSL allows you to easily and quickly install and run Linux distributions and applications on Windows, taking advantage of both operating systems. WSL 2 further enhances performance and compatibility and adds new features.