How to Check Which Linux Distribution is Installed on Windows Subsystem for Linux (WSL)

With the growing popularity of Windows Subsystem for Linux (WSL), many Windows users have turned to it for running Linux-based software directly on their Windows systems. WSL allows you to install and use different Linux distributions such as Ubuntu, Debian, Kali, and more, all within your Windows environment. But how can you check which Linux distribution is installed on your WSL setup? In this blog post, we’ll guide you through the steps to find out.

What is Windows Subsystem for Linux (WSL)?

Windows Subsystem for Linux is a compatibility layer for running a Linux kernel directly on Windows. It eliminates the need for a separate virtual machine or dual-boot setup. You can run your favorite Linux distributions, access the Linux command line, and even run Linux graphical applications seamlessly on your Windows desktop.

Why Would You Need to Check Your Installed Linux Distribution?

There are several scenarios where you might want to know which Linux distribution is installed on your system:

  • You might have installed multiple distributions and want to check which one is the default.
  • You may be troubleshooting an issue and need to know which Linux version you’re working with.
  • You might want to install additional packages specific to a particular distribution.

Now, let’s get into the steps.


Steps to Check Which Linux Distribution is Installed on WSL

Method 1: Using the Command Line (PowerShell or Command Prompt)

  1. Open PowerShell or Command Prompt
    • To check which Linux distribution is installed on WSL, first, open PowerShell or Command Prompt on your Windows system. You can do this by searching for “PowerShell” or “Command Prompt” in the Start menu.
  2. List Installed Linux Distributions
    • Type the following command and press Enter:

      wsl -l

    •     List Installed Linux Distributions
    • This command lists all installed Linux distributions on WSL. The output will look something like this:

      Windows Subsystem for Linux Distributions: Ubuntu (Default) Debian Kali-Linux

      • WSL output

    • The list shows the available Linux distributions, with the (Default) label indicating which one is set as the default distribution.
  3. Detailed Distribution Information
    • To get detailed information about your installed distributions, use the command:

      wsl -l -v

    • This command will show you more details, such as the version of WSL (WSL 1 or WSL 2) and the current state of each distribution:

      NAME            STATE           VERSION * Ubuntu        Running         2  Debian        Stopped         1  Kali-Linux    Stopped         2

Method 2: Using the WSL GUI in Windows 11

Windows 11 comes with an improved WSL experience, including a dedicated GUI for managing WSL distributions.

  1. Open the Windows Store
    • You can access the WSL GUI directly from the Microsoft Store on Windows 11. Search for “WSL” or “Windows Subsystem for Linux” in the store.
  2. Check Installed Distributions
    • The WSL app in the Microsoft Store allows you to see all installed distributions and manage them with a graphical interface.
  3. Open WSL Settings
    • Alternatively, you can manage your distributions via the WSL settings by typing “wsl” into the Start menu and selecting Windows Subsystem for Linux settings.

Method 3: Check via Installed Apps

If you’re uncertain whether you’ve installed a specific distribution or want to see it in the installed apps list:

  1. Open Settings
    • Navigate to Settings > Apps > Installed apps.
  2. Search for Linux Distributions
    • You can search for specific Linux distributions such as “Ubuntu” or “Debian.” Any installed distributions should appear in the list, and you can manage them from here.

Additional Commands for Managing WSL Distributions

Here are a few more commands that can help you manage your WSL distributions:

  • Set Default Distribution:

    wsl --setdefault <DistributionName>

    • Set Default Distribution

    This command sets the specified distribution as the default for future wsl commands.

  • Uninstall a Distribution:

    wsl --unregister <DistributionName>

    • Uninstall a Distribution

    This command unregisters and deletes a distribution from WSL.

  • Launch a Specific Distribution:

    wsl -d <DistributionName>

    • Launch a Specific Distribution

    Use this command to launch a specific distribution, even if it’s not set as the default.


Conclusion

Windows Subsystem for Linux (WSL) provides a powerful tool for developers and Linux enthusiasts, allowing them to run their favorite Linux distributions directly on Windows. Checking which Linux distribution is installed is straightforward using either the command line or the WSL GUI in Windows 11. With a few simple commands, you can list, manage, and even switch between different distributions.

By understanding how to check and manage your WSL distributions, you can take full advantage of the flexibility that WSL offers, whether for development, system administration, or simply exploring Linux in a Windows environment.

Further Reading

  • Microsoft’s Official WSL Documentation
  • WSL 2: The new and improved version of WSL

Happy coding!

How to Fix a Blurry Screen in Windows Remote Desktop (RDP) (F.A.Q)

How do I list all installed Linux distributions on WSL?

Open PowerShell or Command Prompt and run the command wsl -l. This will display a list of all installed Linux distributions on your system. To see more details, use wsl -l -v.

How can I set a specific Linux distribution as the default in WSL?

To set a distribution as the default, use the command wsl --setdefault <DistributionName>. Replace <DistributionName> with the name of your chosen distribution.

How do I uninstall a Linux distribution from WSL?

You can remove a distribution by running wsl --unregister <DistributionName>. This will completely delete the distribution and its files from WSL.

Can I switch between different versions of WSL (WSL 1 and WSL 2)?

Yes, to change the version of a specific distribution, use the command wsl --set-version <DistributionName> <VersionNumber>. For example, wsl --set-version Ubuntu 2 will set Ubuntu to WSL 2.