How to unregister WSL2 Linux distro on Windows 10

Do you need to unregister a Linux distro to reset it to its default settings? Here's how with the WSL command-line tool on Windows 10.

WSL2 unregister Linux distro
WSL2 unregister Linux distro

On Windows Subsystem for Linux 2 (WSL2), it is possible to unregister a Linux distro (such as Ubuntu or Kali Linux) to reset it and start fresh with the distribution without re-downloading the container from the Microsoft Store.

When you unregister a distro on Windows 10, it will no longer be available in the WSL environment, and all the changes made will be discarded. The next time you launch the distro from the Start menu or Microsoft Store, it will start as if it was the first time, and you will need to go through the process to set it up again.

Microsoft defines the unregistering process as a way to uninstall the WSL2 distro, but without deleting the virtual machine from the device like the rest feature available in the Settings app.

In this guide, you will learn the steps to unregister and reinstall a distribution of Linux on the Windows Subsystem for Linux 2 platform.

Unregister Linux distro on WSL2

To unregister a Linux distribution on WLS2, use these steps:

  1. Open Start on Windows 10.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to view a list of all available distros and press Enter:

    wsl --list
    Quick tip: You can also write the command like this: wsl -l.
  4. Type the following command to set a distro as the new default and press Enter:

    wsl --unregister DISTRO-NAME

    In the command, replace DISTRO-NAME for the name of the distro you want to set as default (see step No. 3).

    For example, this command unregisters Kali Linux:

    wsl --unregister Kali-linux

    WSL2 unregister command
    WSL2 unregister command
  5. Type the following command to confirm distros and press Enter:

    wsl --list

Once you complete the steps, the distro will reset and no longer be available in WSL, but it won’t be uninstalled from the computer. If you want to reinstall the distro, click the Launch button from the Microsoft Store or select it from the Start menu to start over with the setup.

About the author

Mauro Huculak is a Windows expert and the Editor-in-Chief who started Pureinfotech in 2010 as an independent online publication. He is also been a Windows Central contributor for nearly a decade. Mauro has over 12 years of experience writing comprehensive guides and creating professional videos about Windows, software, and related technologies, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me.