How to Uninstall a Linux Distro in WSL (wsl --unregister)

🐧Part of the WSL Complete Guide, every Windows Subsystem for Linux post on this site, organised by task.

To uninstall a Linux distro from WSL, get its exact name, then unregister it from PowerShell or Command Prompt:

PowerShell
# list distros: use the NAME column exactly as shown
wsl -l -v

# remove one
wsl --unregister Ubuntu-20.04

wsl --unregister deletes the distro and its root filesystem: every file, setting and package inside it. There is no undo, so copy out anything you want to keep first, or take a full export with How to Back Up and Restore a WSL Distro.


Uninstalling a WSL Distro

1. Check Installed WSL Distributions

To view all the Linux distributions installed on your system, open PowerShell or Command Prompt and run the following command:

Shell
# show list of wsl distros
wsl -l -v

This will list all installed distros, showing their names, running status, and WSL version.

Take the distro name from this to use in the next command.

2. Unregister and Uninstall the Distro

To remove the Linux distribution, use the wsl --unregister command with the name of the distro. For example, to uninstall Ubuntu-20.04, run:

Shell
# unregister a wsl distro
wsl --unregister Ubuntu-20.04

Note: This action is permanent. Reinstalling the distro later gives you a fresh copy, not your old data. This command will unregister and remove all files, settings, and software associated with the chosen distro.

wsl --unregister

3. Verify the Distro Has Been Removed

To check that the distro has been successfully uninstalled, run the wsl -l -v command again:

Shell
# show list of wsl distros
wsl -l -v

The distro you uninstalled should no longer appear in the list.

wsl --unregister Ubuntu completing successfully, then wsl -l listing only docker-desktop

Additional Tips for WSL Users

Uninstalling a Linux distribution from WSL is a simple process using the wsl --unregister command. Just remember that this action permanently deletes the distro and its data, so back up anything you want to keep.

If you decide to reinstall a Linux distro, simply go to the Microsoft Store or use the command wsl --install -d <distro-name> to install it again (wsl --list --online shows the names it accepts). You can also check out my other post on how to install WSL for more information.


Related

If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.