How To Use Windows Subsystem For Linux

Windows Subsystem for Linux (WSL) is a compatibility layer developed by Microsoft that allows you to run Linux binaries natively on Windows 10 and Windows Server 2019. It provides an environment for Linux-compatible tools and applications without the overhead of a traditional virtual machine or dual-boot setup. This tutorial will guide you through the process of installing and using WSL.

Step 1: Enable the WSL feature

WSL is not enabled by default on Windows. You need to enable it manually. Open Windows PowerShell as an administrator and run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Once the command has completed, you’ll need to restart your computer for the changes to take effect.

Step 2: Install a Linux distribution

After restarting your computer, the next step is to install a Linux distribution from the Microsoft Store. You can search for “Linux” in the Microsoft Store and choose the distribution that meets your needs. For this tutorial, we’ll use Ubuntu as an example. After selecting Ubuntu from the list of distributions available, click on the “Get” button to start the download and installation process.

Step 3: Initialize your Linux distribution

Once the distribution has been installed, you can launch it from the start menu. The first time you launch your Linux distribution, a console window will open, and you’ll be asked to wait for a minute or two for files to de-compress and be stored on your PC. After this, you’ll be asked to create a user account and password for your new Linux distribution.

Step 4: Update and upgrade your distribution

After you’ve set up your new Linux user account, you’ll want to ensure that your Linux distribution is up to date. You can do this by running the following commands in the Linux console:

            sudo apt update
            sudo apt upgrade
            

Step 5: Using WSL

You’re now ready to start using the WSL. You can use the Linux command line just as if you were using a regular Linux system. For example, to list the files and directories in your Linux home directory, you can use the command:

ls -la

That’s it! You’ve now got a fully functional Linux subsystem on your Windows machine. You can install and run Linux software, access your Windows files from within Linux, and much more.