Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Uninstall WSL on Windows 11 From the Command Line

· 6 min read · Home Tech

In this article
  1. Know What You Are Removing
  2. Unregister a Linux Distribution
  3. Uninstall the WSL Application
  4. Disable the Windows Features
  5. Recommended Removal Order and Checks
  6. Common Problems and Misconceptions
  7. Frequently Asked Questions

To uninstall Windows Subsystem for Linux (WSL) from Windows 11 using the command line, first remove any Linux distributions you no longer need, then disable the WSL and Virtual Machine Platform optional features if you want to remove WSL itself. Open Windows Terminal or Command Prompt as an administrator; the exact commands depend on whether you want to remove one distribution, all Linux data, or the Windows components too.

Know What You Are Removing

WSL has several parts, and removing one does not automatically remove the others. A Linux distribution such as Ubuntu contains its own files, accounts, and installed software. The WSL application provides the commands and support needed to run distributions. Windows optional features, including Windows Subsystem for Linux and Virtual Machine Platform, provide system-level support.

Choose the scope before running commands:

  • Remove a distribution: Deletes that distribution and its Linux filesystem, but leaves WSL and other distributions in place.
  • Remove the WSL application: Uninstalls the WSL package, but does not necessarily remove every distribution or disable the Windows features.
  • Disable WSL features: Turns off the Windows components that enable WSL. This is the broadest option and may require a restart.

Back up anything important before removing a distribution. Its Linux files are not the same as files in your ordinary Windows folders, and unregistering a distribution is destructive.

Unregister a Linux Distribution

To see installed distributions and their exact names, run this in an administrator or regular terminal:

wsl --list --verbose

You may also use the shorter command wsl -l -v. The list shows distribution names and whether they are running. To permanently remove one, use its displayed name:

wsl --unregister Ubuntu

Replace Ubuntu with the exact name shown on your computer, such as Ubuntu-24.04 or Debian. This command unregisters the distribution and deletes its WSL filesystem, including files in its Linux home directory, installed packages, and configuration. It does not simply stop the distribution, and there is no ordinary undo command.

If you want to preserve the distribution, export it first to a tar archive on a drive with enough free space:

wsl --export Ubuntu D:\Backups\ubuntu-backup.tar

Choose a valid folder and filename for your system. You can later import an exported archive with wsl --import, although restoring it may require choosing a new installation location and configuring the default Linux user. An export is a backup of the distribution, not a way to keep it installed while removing it.

Uninstall the WSL Application

On Windows 11 installations where WSL is installed as a packaged app, you can remove that app with Windows Package Manager, winget. First check whether it is installed and identify the package:

winget list --name Windows Subsystem for Linux

If the result identifies the WSL package, uninstall it by its package ID. The ID commonly used for the Store version is Microsoft.WSL:

winget uninstall --id Microsoft.WSL

If winget cannot find that ID, use the exact name or ID shown by the list command, or remove the app through Settings > Apps > Installed apps. Availability and package details can vary depending on how WSL was installed. Removing the app is not the same as unregistering distributions or disabling optional Windows features. Check the distribution list and feature state separately if your goal is complete removal.

Disable the Windows Features

To turn off the optional features that support WSL, run the following commands in an elevated Command Prompt or Windows Terminal. They use DISM, the Windows Deployment Image Servicing and Management tool:

dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart

The first command disables the WSL optional feature. The second disables Virtual Machine Platform, which is used by WSL 2 and can also be needed by other virtualization software. If you use software that relies on this platform, consider leaving that feature enabled. Disabling it can affect those programs as well as WSL.

After the commands finish, restart Windows to complete the feature changes. You can check the state of the features with:

dism.exe /online /get-features /format:table

Look for Microsoft-Windows-Subsystem-Linux and VirtualMachinePlatform. If the commands report that a feature name is unknown, check the spelling and whether the feature is available in your Windows installation. You can also use PowerShell’s Disable-WindowsOptionalFeature command, but DISM works directly from Command Prompt and is convenient for this task.

If you want to remove WSL completely rather than just one Linux environment, use a careful order. First inspect the distributions, back up anything needed, and unregister each one. Then uninstall the WSL app if it is present, disable the optional features, and restart. For example:

  1. Run wsl --list --verbose and note every installed distribution.
  2. Export any distribution you may want to restore, then unregister the distributions you intend to delete.
  3. Use winget list to check for the WSL app and uninstall it if listed.
  4. Disable the WSL and Virtual Machine Platform features with DISM, if you want those Windows components turned off.
  5. Restart Windows, then check the feature states and run wsl --list --verbose to confirm the result.

These actions are not always necessary together. For example, uninstalling Ubuntu alone does not require disabling WSL, and disabling Virtual Machine Platform may be undesirable if another application depends on it. “Completely uninstall WSL” can therefore mean different things: removing Linux data, removing the app, disabling Windows features, or all three.

Common Problems and Misconceptions

If wsl --unregister says the distribution cannot be found, copy the name exactly from wsl --list --verbose. A distribution may have a version suffix or a custom name. If it is running, close its Linux sessions first; if needed, stop WSL with wsl --shutdown and try again. The shutdown command stops running WSL instances but does not delete them.

If Windows says a restart is required, restart rather than repeatedly running the feature command. If DISM reports access denied, reopen the terminal using Run as administrator. If winget is unavailable, you can use Settings to uninstall the WSL app; that does not prevent you from using DISM to manage Windows features.

One common misconception is that deleting the Ubuntu app or shortcut removes every WSL file. It may not unregister the distribution’s filesystem. Conversely, removing the WSL app does not necessarily delete a distribution. Use the explicit unregister command when you intend to erase a Linux environment, and verify the name before confirming.

Frequently Asked Questions

Does wsl --unregister delete my files?
Yes. It permanently deletes the selected distribution’s Linux filesystem, including its user files and installed software. Export it first if you need a backup.

How do I uninstall only Ubuntu but keep WSL?
Run wsl --list --verbose, then use wsl --unregister Ubuntu with Ubuntu’s exact listed name. Leave the WSL app and Windows features enabled.

Do I need to disable Virtual Machine Platform?
Not if you are only removing a distribution. It is used by WSL 2 and may support other virtualization software, so disable it only if you want to turn off the feature and do not need it elsewhere.

Will uninstalling WSL require a restart?
Disabling Windows optional features commonly requires a restart to finish applying the change. Removing a distribution alone usually does not require one.

Can I reinstall WSL after removing it?
Yes. WSL can be installed again, for example with wsl --install on supported Windows versions. Reinstalling does not restore a distribution that was unregistered; restore that from an export or install a fresh distribution.