Reset button

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

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.