How to Install Linux on Windows with WSL

Install Linux Windows Wsl Featured

For a full Linux experience, there’s no substitute for a full install. But if you’re a Windows user wishing to install Linux, Windows Subsystem for Linux (WSL) is a great place to start. Getting a Linux distro up and running on your Windows machine is pretty easy, whether you’re just learning Linux or want to use a Linux development environment, so it’s worth a shot if you’re at all curious. Here you’ll learn how to install Linux on Windows with WSL.

What Is Windows Subsystem for Linux (WSL)?

Windows Subsystem for Linux (WSL) is an installable feature in Windows that lets you run a Microsoft Store-supported Linux distro on a Windows 10 or Windows 11 device. Microsoft has partnered with Canonical (the publisher of Ubuntu) to bring its bash command line capabilities to a typical Windows desktop so that you can integrate both Linux and Windows into your workflow.

WSL supports Linux file systems using commands for Bash but cannot offer a full Linux desktop experience, which is only possible with a virtual machine or dual-boot procedure. From Windows 11 onward, WSL supports native Linux GUI applications, such as Gedit, GIMP, and Nautilus in conjunction with Bash.

To a Linux user who likes using the command line tools, WSL feels very natural and normal. It’s quite useful for Windows developers, too, who want to deploy Windows applications to Linux server environments.

Linux Distros That Work with WSL

To work with your favorite Linux distro in WSL, first ensure it can be downloaded from the Microsoft Store. Supported examples include:

WSL Benefits: What You’ll Get

The following are the main benefits of using WSL on your Windows device:

  • Having Linux on top of Windows: you’ll end up with a Linux virtual machine you can run on Windows. You can have any of your favorite distro installed and running at the same time.
  • Run Linux apps as standalone Windows applications: whether you want to launch Linux apps from the Windows Start menu or pin them to the Windows taskbar, WSL lets you access them from your Windows desktop.
  • Switch between Windows and Linux: you can switch quickly between Linux and Windows and, perhaps most importantly, access your Windows files and programs from inside the Linux shell. WSL is perhaps the only software that allows Cut and Paste across Windows and Linux apps.
  • Support for cross-platform languages and services: with WSL in place, you can run advanced programs between two integrated operating systems. These include vim, emacs, NodeJS, Python, Ruby, C/C++, Rust, Go, MySQL, Apache, and MongodB.
  • Supports Windows applications for Linux user habits: are you a frequent Linux user? Now you can bring your favorite Linux commands to a Windows desktop without having to deal with its user interface. Whether you want to edit a Word file or run Notepad++, you can easily do it the Linux way.

On the other hand, if you’re a Windows user who has never used Linux before, you’ll need to learn some basic Linux commands to get started. Don’t worry. There aren’t too many of them for a Windows user’s needs.

Installing and Setting Up WSL in Windows 10

You’ll need to be running an up-to-date version of Windows 10 for this to work, but that’s just about the only requirement apart from knowing how to use Windows PowerShell or Command Prompt.

The instructions below will set you up with the most recent version of Windows Subsystem for Linux (WSL2, Build 21354 as of September 2021).

  1. On your Windows 10 device, search for a Control Panel feature called “turn Windows features on or off.”
Wsl Install Turn Windows Features On Or Off
  1. When the Windows Features menu screen opens, check the options for “Windows Subsystem for Linux” and “Windows PowerShell.”
Linux Windows Wsl Options
  1. Open PowerShell or (Command Line). Make sure you run it as an administrator.
  2. Paste in the following script:
Wsl Install Powershell Wsl Script Enabling
  1. If it prompts you to restart, do so; otherwise, move on.
  2. Open the Microsoft Store and search for “Linux” to see all your available options. Here, we are installing Ubuntu.
Wsl Install Select Linux App Microsoft Store
  1. Click the “Install” button from within the Store app. It will download your desired Linux distro.
Wsl Install Downloading Wsl From Store
  1. You will get a notification once the Linux distro has been installed on your Windows 10 desktop. In the future, you can open this directly from your Start Menu.
Wsl Install Downloaded Distro Installed
  1. Once the Linux bash window opens, choose a username. It doesn’t have to be the same as your Windows login.
Wsl Install Downloaded Distro Enter Username
  1. Enter a password and retype it.

Note: the password is invisible, so make sure you store it in a safe place. If you forget your password, you’ll have to uninstall the Linux distro, which will delete all your Linux files.

02 Wsl Installation Successfuljpg
  1. Update your installation using:
Wsl Install Sudo Apt Update Continued
  1. Wait for the updates to complete, then check for any upgradable versions in your Linux distro using:
Wsl Install Apt List Upgradable
  1. Once you find all the available upgrades, enter the following to ensure all of them are applied to your system:
Wsl Install Sudo Apt Upgrade
  1. The updates take some time, as templates are extracted from Linux packages, followed by a pre-configuration and the settings being applied. Be patient as this process is automatic.
Wsl Install Sudo Apt Upgrade Happenning
  1. If you want to install any specific Ubuntu packages, such as npm, groovy, impish, or hirsuit, you can use:
Wsl Install Sudo Install
  1. Wait for the updates to finish, when the green progress bar goes all the way to 100 percent. If there are any errors due to your PC misconfiguration, the progress bar will turn red and suggest remedial actions.
Wsl Install Sudo Install Progressing

Using WSL with Windows

If you want, you can use your Linux installation as its own system on Windows, with totally separate files and programs. You may want some files stored on Linux for its speed advantages, but one of the big perks of WSL is that you can interact with your Windows files and folders by effectively mounting the drive to your Linux system. This enables you to use Linux with anything you have on Windows, thus keeping all your stuff in the same place.

Now that you’ve learned how to install Linux using WSL on your Windows 10 device, it’s time to familiarize yourself with its basic commands.

Basic Linux Commands

If you’re familiar with Linux command line navigation, you can skip down a little bit. Otherwise, the following are some basic commands you’ll need to know to move around in a Linux command line.

Using Linux commands in a Windows shell like PowerShell or command prompt is easy. Just use:

  1. For example, here’s the command for “print working directory,” which shows you the path of the current directory from the root.
  1. If you want to list all the contents of your current directory using the Linux command, just enter:

This will execute the Linux command on Windows without opening the actual operating system.

  1. Sometimes you will need to create directories in Linux. For that, use:
  1. To change the default path file to your newly created directory, use:

Check the below screenshot to see all the above highlighted commands in action.

Wsl Install Basic Linux Commands
  1. If you want to start the entire operating system from inside PowerShell or Command Prompt, that’s also easy. Just run:

or

Wsl Install Commands Wsl Bash

Eventually, though, you’ll probably wonder how to access Windows directories from inside your Linux system itself. The key here is that Windows is essentially mounted as an external drive to the Linux system, so Linux can use it as storage, making it pretty much the same as using your OS to edit files on a flash drive.

  1. Open your Linux terminal (Ubuntu, in this case) as a Windows administrator.
Wsl Install Launch Downloaded Distro
  1. Access your Windows C: drive by entering:
Wsl Install C Drive Accessed
  1. To see some editing in action, create a folder using:
Wsl Install Create Directory
  1. Open File Explorer and check your C: drive to confirm that Ubuntu created a folder there.
Wsl Install Create Directory Verified
  1. Go down to the directory path by typing:
Wsl Install Create Directory Opened
  1. Create a file using:
Wsl Install Create Directory File Created
  1. Check that the newly created text file is available in the chosen directory.
Wsl Install Create Directory File Created Verified
  1. To edit the file, use:
Wsl Install Nano Command
  1. To test, add any dummy text in the command screen. This will add changes to the bash-created file.
Wsl Install Nano Command Editing

Enter a few words, then press Ctrl + O to save and Ctrl + X to exit.

  1. Check your Windows file system again. You should see a text file with the content you entered.
Wsl Install File Saved

If you’d like, you can navigate to any other folder or document on your Windows drive and edit it using Ubuntu.

  1. Let’s say you want to access your Linux files in Windows or maybe just want a GUI representation of your filesystem. Navigate to the Linux directory you want to see and enter:
Wsl Install Explorer Exe

The . at the end stands for the current directory, and if you include it, explorer.exe will launch a Windows Explorer window that shows your Linux files.

  1. You can actually launch other Windows apps and run Windows commands from Linux as well. For example:

launches Notepad.

Wsl Install Open Notepad With Linux

Run Linux GUI Apps in Windows 11

So far we’ve seen how to run Linux with the command line in Windows 10. From Windows 11 onward, it is now possible to have a limited GUI experience on Windows Subsystem for Linux (WSL).

You have to at least be on a Windows 11 build 22000 or higher to enjoy the GUI apps for Ubuntu or any other supported distro package.

  1. Upgrade from Windows 10 to Windows 11 by following the steps listed in this guide.
  2. On your Windows 11 device, go to PowerShell in Administrator mode. To install Ubuntu, enter the following:
Wsl Install Powershell Windows11 Downloading Ubuntu 1
  1. You may also want to update the WSL on your device using
  1. Wait for the distro download to complete. To work with the changes, reboot the system once.
Wsl Install Powershell Windows11 Gui App Support Installed
  1. After the restart, the feature updates will take effect, and the new distro will be installed on your Windows 11 device. It will automatically launch from here.
Wsl Install Launching Ubuntu
  1. Once the target distro has been launched in Windows 11 bash window, you can install any GUI apps such as Gedit, which is a text editor.
Wsl Install Gedit Installing
  1. After the GUI app gedit is installed, you can launch it using:
Wsl Install Gedit Launch

We have seen how to install and launch GUI apps in your Linux Bash terminal. If you know the relevant Linux commands, you can start trying them out in Windows.

Frequently Asked Questions

1. How do I uninstall WSL or Linux distros from my Windows PC?

You can uninstall WSL and its distros using PowerShell/Command line or from “Add or remove programs” in Windows 10/“Apps and Features” in Windows 11.

To uninstall any configured Linux distro using PowerShell in a Windows PC, use the following command in Admin mode:

Wsl Uninstall Unregister Ubuntu

To verify that the distro has been uninstalled, use:

Wsl Install List Of Distros

To differentiate WSL from PowerShell, enter the following which will give a list of installed applications. You can further use wsl –- help to be guided toward the uninstallation.

Wsl Uninstall List Of Programs

Of course, the easier way to uninstall WSL is to access it in your list of apps and click the Uninstall button. The following screen is for Windows 11.

Wsl Install Uninstall Wsl Preview App Gui

2. Where are my WSL files stored on a Windows device?

To access WSL files on a Windows 10/11 device for any installed distro, search for the %LOCALAPPDATA% hidden folder in C drive.

3. Is Windows Linux Subsystem safe to use?

Yes. The host Windows system always has full control over the guest Linux subsystem. As long as you have enabled security features in Windows with Windows Defender and corrected the Setting errors in Defender file, your virtual Linux subsystem is safe to use.

What Else Can You Do?

Now that you know how to install Linux on Windows 10 and 11 and how it interacts with Windows, you can do just about whatever you want. You can run programming languages, run local servers, use a Windows IDE to work in the Linux shell, run multiple Linux distros at the same time, or just play around with Linux to get comfortable with the command line. The price of failure is pretty low. If you mess something up, resetting or reinstalling your Linux distro is pretty easy.

To work with bash prompts, check the best options available. While you’re running a Linux subsystem on Windows, check out some of the best Linux games to play on your Windows PC.

Sayak Boral Sayak Boral

Sayak Boral is a technology writer with over eleven years of experience working in different industries including semiconductors, IoT, enterprise IT, telecommunications OSS/BSS, and network security. He has been writing for MakeTechEasier on a wide range of technical topics including Windows, Android, Internet, Hardware Guides, Browsers, Software Tools, and Product Reviews.

4 comments

  1. What is the advantage, if any, in running Linux under WSL over dual booting Linux and Windows, or running Linux in a VM?

    1. Hey Dragon…nice to hear from you after such a long time.

      Linux under WSL is more of a workaround rather than a proper Linux environment with a desktop and responsive menu icons, which is something you don’t get. But now with Linux GUI apps under Windows 11, it has changed. You can now have a GUI experience with Gedit, Gimp, Nautilus, Google Chrome under Linux, MS Edge under Linux.

      We will see more feature additions in the future.

      The advantage is mainly for Windows users who want to learn about Linux. WSL makes it convenient to run it as just another app on their Windows desktop, which can be pinned to the Taskbar/Start menu.

      For a proper Linux user: they can use it to run their favorite Windows applications provided they’re heavy users of the command-line (i.e. they don’t have to deal with Windows user interface).

      Would you find WSL useful? Let us know.

      1. “Would you find WSL useful?”
        I have happily been Windows-free for more than 15 years, running various Linux distros, so the answer is NO. However, for someone who MUST run Windows for whatever reason, I suppose WSL does offer some kind of a solution. It’s like using AbiWord instead of MS Word. You get the job done but miss a lot of the features.

  2. Why not just install Linux? That will definitely get you the full Linux experience.
    If you must have Windows just dual boot.

Leave a Comment