When you need to run Linux command-line tools or even GUI applications on a Windows machine, the first thing to come to mind is often virtual machines. And while that does work, there is a better option. The Windows Subsystem for Linux (WSL) feature creates a compatibility layer that allows you to run Linux binary executables natively on Windows.

This is more efficient as WSL doesn’t have to deal with the overhead of a usual VM setup, meaning it requires fewer resources. WSL also allows you to use both Windows and Linux tools on the same files, as you’re able to directly access the Windows files from Linux.

And while there are numerous such reasons to use WSL, the one that’s most relevant to us is that WSL lets you use a Linux terminal on Windows. As such, we’ll focus on WSL and the steps to install a Linux terminal using it in this article.

dism-enable-microsoft-windows-subsystem-linux

Microsoft first introduced WSL in 2016 with the Windows 10 version 1607 Anniversary Update. WSL 1 used the LXSS Manager Service (particularly thelxss.sysandlxcore.sysdrivers) for interactions between Windows and the subsystem.

WSL 1 didn’t utilize virtualization and instead made direct use of some of the hardware and the host file system, which had some implications. For instance, the virtual network adapter would be bridged to the host NIC, meaning the Linux distribution would have an IP address in the same network as the host machine.

WSL 2 was released with the version 2004 update in 2020. It made considerable changes to the architecture to increase file system performance and support full system call compatibility.

get-debian-ms-store

WSL 2 utilizes a specific optimized set of Hyper-V features to run the Linux kernel inside a lightweight VM. The hardware components are virtualized as well, but because this VM runs behind the scenes, the user experience is no more complicated than before.

The WSL 2 VM uses a full Linux kernel that’s optimized for best performance and auto-serviced via Windows Updates. And while WSL 1 stored the Linux files on the Windows drive, WSL 2 uses a virtual hard disk formatted with ext4. This essentially means that WSL 2 offers way better performance, compatibility, and support for GUI applications.

WSL 2 is only supported on Windows 11 or Windows 10 version 1903 or later. Aside from somevery niche scenarios, you should always opt for WSL 2, provided it’s supported on your Windows build.

wsl-debian-username-password

With all that said, we’ll first talk about installing WSL 1. But if you just need steps to upgrade to or install WSL 2, you may skip ahead to the next section.

Install Linux Terminal For Windows

Here’s how you may install a Linux terminal with WSL 1:

you may manage WSL’s Linux distros via Powershell or CMD with thewslcommand (eg.wsl ls -la), or you can enterbashto open a Bash shell. Microsoft recommends using Windows Terminal, as it allows you to open and switch between multiple distros and command lines easily.

ls-la-wsl-debian

Install or Upgrade to WSL 2

As WSL 2 utilizes virtualization, you must firstenable hardware-assisted virtualizationvia the BIOS. You’ll find the virtualization option (AMD-V, SVM, VT-d, VT-x, or something similar) in the Advanced or CPU Configuration section.

wsl-l-o

wsl-set-version-distribution-version

where-new-content-is-saved