Uninstalling Windows Subsystem for Linux (WSL) can mean removing the WSL runtime, deleting one or more Linux distributions, or disabling the Windows features WSL depends on. These are separate actions: unregistering a distribution permanently deletes its files, while disabling a Windows feature may affect other virtualization tools. This guide shows how to check what is installed, back up anything important, and choose the right level of removal from PowerShell. You will need an administrator PowerShell window for Windows feature changes; back up any Linux files you want to keep before proceeding.
What You’ll Need
- A Windows account with administrator access if you plan to disable optional Windows features.
- PowerShell, preferably opened with Run as administrator for the whole procedure.
- The exact WSL distribution names shown on your computer, plus enough disk space for any backups.
- A destination outside the distribution, such as a Windows folder or external drive, for exported backups.
Step-by-Step
-
Open an elevated PowerShell window and inspect WSL. Open Start, search for PowerShell or Windows Terminal, right-click it, and select Run as administrator. Approve the UAC prompt. Check the installed WSL version and distributions:
wsl --version wsl --list --verboseThe list shows the distribution names and whether each is running, as well as its WSL version. Record the names exactly as displayed; a name such as
Ubuntu-22.04is not interchangeable withUbuntu. If the version command is unsupported on your Windows build, continue with the distribution list and use the fallback steps below if needed. -
Back up any Linux files you might need. Unregistering a distribution deletes its Linux filesystem, including files in its home directory, installed packages, and configuration. To export a distribution, make a backup folder and substitute the exact name and a suitable Windows path:
New-Item -ItemType Directory -Force -Path "D:\WSL-backup" wsl --export "Ubuntu-22.04" "D:\WSL-backup\Ubuntu-22.04.tar"Repeat the export command for each distribution you want to preserve. Check that the resulting TAR file exists and is a plausible size before deleting anything. An export is a backup, not a live Linux installation; you can import it later with
wsl --import. Do not save the only copy inside the distribution you are about to remove. -
Stop running WSL processes. Shut down running distributions and the WSL virtual machine:
wsl --shutdownThis closes Linux processes and releases the WSL virtual machine. Save work in Linux applications first, because unsaved changes may be lost. If you use Docker Desktop or another tool that relies on WSL, close it too. You can check again with
wsl --list --verbose; a distribution may still appear in the list even though it is stopped. -
Remove the distributions you do not want to keep. If your goal is a clean removal, unregister each listed distribution individually:
wsl --unregister "Ubuntu-22.04"Replace the example with one exact name from your list, then repeat for any other distributions. This command deletes that distribution and its files immediately; it does not move them to the Recycle Bin. Confirm the name before pressing Enter. If you want to retain a distribution, do not unregister it unless you have a verified export and are comfortable restoring it later.
Unregistering removes the Linux environment, but a separately installed distro app may remain in Windows. To identify an Ubuntu app package for the current user, for example, run
Get-AppxPackage *Ubuntu* | Select-Object Name, PackageFullName. Only if you intend to remove the listed app, use its exact package name withRemove-AppxPackage -Package "PACKAGE_FULL_NAME". Do not copy the placeholder literally, and do not remove packages you cannot identify. -
Uninstall the WSL runtime. With the distributions handled, try the supported WSL command:
wsl --uninstallRead any confirmation or error message before responding. On supported WSL installations, this removes the WSL package/runtime. The command may not be available on older Windows builds or older inbox versions of WSL. If PowerShell reports that the option is unknown, do not assume WSL is already gone; use the Windows-feature method in the next step. Runtime removal and distribution deletion are distinct, which is why checking and backing up the distributions first matters.
-
Optionally disable the Windows features WSL uses. This is the deeper cleanup step, and it requires administrator privileges. First inspect whether the features are enabled:
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatformIf you want to remove WSL completely and do not depend on either feature for another application, disable the features that are enabled:
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart Disable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestartThe first feature supports WSL. The second provides the virtualization platform used by WSL 2 and may also be needed by other software, including some virtual-machine and container tools. Skip disabling it if another program needs it. If a command says the feature is unknown or unavailable, do not substitute a similarly named feature at random.
-
Restart Windows and verify the result. If Windows reports that a restart is pending, save open work and restart. After signing back in, open PowerShell and run:
wsl --list --verbose Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-LinuxIf you also chose to disable Virtual Machine Platform, check its state with the matching
Get-WindowsOptionalFeaturecommand. A missing WSL command, no registered distributions, or a feature state ofDisabledcan each confirm a different part of the cleanup. Decide what you wanted to remove rather than treating every leftover feature or app entry as a failure.
Common Mistakes
- Running unregister without a backup.
wsl --unregisterpermanently deletes that distribution’s data. Export first and verify the backup file. - Confusing shutdown with uninstall.
wsl --shutdownonly stops running WSL processes. It does not remove WSL or a distribution. - Disabling Virtual Machine Platform without checking dependencies. This can break other virtualization or container software. Disable it only if you no longer need it.
- Assuming the WSL runtime and distro app are the same thing. A distro may have a separate Microsoft Store app package. Removing its package does not replace the need to manage its registered Linux filesystem.
- Using the wrong distribution name. Copy the exact name from
wsl --list --verbose. A mistyped or guessed name can cause the command to fail or target a different environment than intended. - Expecting the change to finish without a restart. Windows feature changes often require a restart before they take effect.
Tips
- Choose your goal before running commands. To stop using Linux temporarily, simply shut WSL down; to remove one environment, unregister only that distribution; to remove WSL system-wide, also uninstall its runtime and consider the optional Windows features.
- Export every distribution you may want to restore, and keep the backup on a separate drive or in a protected Windows folder. A successful command message alone is not proof that the backup is usable; check that the file was created.
- Run commands one at a time and read their output. This makes it easier to identify whether a problem concerns a distro, the WSL package, or a Windows optional feature.
- If you are keeping Linux data, leave the distro registered and do not use
--unregister. Export before changing the runtime, then plan to reinstall or import the distribution if it is no longer available afterward.
Troubleshooting
“The term wsl is not recognized” or “Invalid command line option.” Your Windows installation may be using an older inbox version of WSL, or the WSL command-line tools may not be available in that session. Confirm that you are using a current Windows build and open a new PowerShell window. If wsl --uninstall is unsupported, use Get-WindowsOptionalFeature to inspect the two feature names in Step 6, then disable only the features that are present and that you no longer need. Older systems may require an administrator restart between feature changes.
“Access is denied” or a feature command fails. Close PowerShell, reopen it with Run as administrator, and approve the UAC prompt. Check that the feature name is exactly Microsoft-Windows-Subsystem-Linux or VirtualMachinePlatform. If your PC is managed by work or school, an administrator policy may prevent changing optional features; contact the device administrator rather than trying to bypass the policy.
A distribution is busy or will not unregister. Run wsl --shutdown, close Linux terminals and applications, and quit software that may start WSL in the background. Then run wsl --list --verbose to confirm the exact distro name and try again. If a process continues to restart WSL, identify and close the application that owns it before unregistering.
WSL still appears after you remove it. Find out what remains: a distro listed by wsl --list, a separate distro app in the Start menu, or an enabled Windows optional feature. They are different components and may need different actions. Restart after changing features, then check again. Do not delete WSL folders manually as a first fix; doing so can leave registrations or app data inconsistent.
Another virtualization app stops working. If it stopped after you disabled Virtual Machine Platform, re-enable that feature from elevated PowerShell with Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -All, then restart. This restores the shared Windows feature; it does not reinstall WSL distributions or recover files deleted by unregistering.
Frequently Asked Questions
Does wsl --uninstall delete my Linux files?
Do not rely on it as a backup or assume it preserves every distribution in every WSL setup. Export important distributions first. wsl --unregister definitely deletes the selected distribution’s filesystem.
Can I uninstall just Ubuntu and keep WSL?
Yes. Export Ubuntu if needed, then run wsl --unregister "Ubuntu" using its exact listed name. Leave the WSL runtime and Windows features installed. Remove the separate Ubuntu app package only if you also want that Windows app gone.
Do I need to disable both Windows features?
No. Disable the WSL feature if you want to remove its Windows component. Disable Virtual Machine Platform only if WSL 2 is no longer needed and no other software depends on it; otherwise leave it enabled.
Can I reinstall WSL later?
Usually, yes. Install WSL again using the supported Windows installation method for your version, then install a distribution or import a saved TAR backup with wsl --import. Keep the export until you have confirmed the restored files are present.
Is PowerShell required?
No; some WSL actions also work in Command Prompt or Windows settings. PowerShell is useful here because it can run WSL commands and inspect or change Windows optional features in one place. Administrator rights are needed for system feature changes, not for every basic WSL command.