Knowing how to close WSL in Windows can help you free system resources, stop background Linux processes, and troubleshoot a distribution that is no longer responding. The right method depends on whether you want to close one Linux distribution, stop every WSL distribution, or simply exit a terminal window. In most cases, a single command is all you need.
This guide explains how to shut down WSL on Windows 10 and Windows 11, how to close an individual distribution, and how to check whether WSL is still running. It also covers common issues, including why closing Windows Terminal may not stop Linux processes completely.
Quickest Way to Close WSL in Windows
To stop all running WSL distributions and shut down the WSL 2 virtual machine, open PowerShell or Command Prompt and run:
wsl --shutdown
This command stops every running WSL distribution for your Windows user. It also shuts down the lightweight virtual machine used by WSL 2. Your Linux files and installed applications are not deleted; the command simply stops the WSL environment. You can start a distribution again at any time by opening it from the Start menu or running a WSL command.
Use wsl --shutdown when you are finished with all your Linux environments, when WSL is consuming resources in the background, or before restarting or troubleshooting WSL. You do not normally need to open PowerShell as an administrator.
Close One WSL Distribution Without Stopping the Others
If you have more than one Linux distribution installed, you can stop just one of them. First, check the distribution names and which ones are running:
wsl --list --verbose
You may see output like this:
NAME STATE VERSION
Ubuntu Running 2
Debian Stopped 2
Use the name shown in the first column with the --terminate option. For example, to stop Ubuntu, run:
wsl --terminate Ubuntu
This stops the named distribution while leaving other running distributions alone. If you are unsure of the exact name, copy it from the output of wsl --list --verbose. Distribution names can include spaces, so enclose a name in quotation marks when necessary, for example: wsl --terminate "Ubuntu 24.04".
The command may also be written in its shorter form:
wsl -t Ubuntu
Terminating a distribution ends its running Linux processes. Save your work and close applications inside that distribution first, especially programs that are editing files or performing long-running tasks.
Exit the Linux Shell or Close Windows Terminal
If you only want to leave the current Linux shell, type this at the Linux prompt:
exit
You can also press Ctrl+D in many shells. If the shell is the only active process keeping the distribution running, it may stop shortly afterward. However, exiting the shell is not the same as running wsl --shutdown. Background services, other shell sessions, or Linux applications can keep the distribution active.
Closing the Windows Terminal window has a similar limitation. It closes that terminal session, but it does not always stop every process running in WSL. If your goal is to make sure WSL is fully stopped, use wsl --shutdown. If you want to stop only one distribution, use wsl --terminate with its name.
Check Whether WSL Is Still Running
After shutting down WSL, you can check the status of your distributions by running:
wsl --list --running
If none are running, Windows may display a message indicating that there are no running distributions. You can also run wsl --list --verbose to see every installed distribution and its status. A distribution marked Stopped is not currently running.
Keep in mind that a distribution may start again when you open it, launch a Linux application, or use a Windows program that depends on WSL. For example, development tools and container software may start WSL in the background. If it appears to restart after shutdown, check whether one of these applications is using it.
What Happens When You Run WSL --shutdown?
The wsl --shutdown command shuts down all running WSL distributions for your account. With WSL 2, it also stops the shared virtual machine that hosts those distributions. This can release memory and other resources that WSL was using. The next time you launch a distribution, WSL starts again automatically.
Because the command affects every running distribution, it is not the best choice when you need another Linux environment to keep running. Use wsl --terminate DistributionName instead when you want to stop only one. In either case, shutdown does not uninstall the distribution, erase its files, or reset its settings.
Applications that rely on WSL may be affected while it is stopped. For example, a development server running in Linux will no longer be available, and container workloads managed through WSL may stop. Save work and check for running tasks before shutting down.
Close WSL from Windows Terminal
You can run WSL management commands from Windows Terminal without opening a Linux shell. Open a PowerShell or Command Prompt tab in Windows Terminal, then enter the command you need:
-
wsl --shutdownstops all running distributions. -
wsl --terminate Ubuntustops the Ubuntu distribution only; replaceUbuntuwith your distribution’s name. -
wsl --list --runningshows which distributions are currently active.
If Windows Terminal is currently showing a Linux prompt, type exit to leave that shell. To run a full shutdown afterward, open a PowerShell or Command Prompt tab and enter wsl --shutdown. You can also return to the Windows prompt first, depending on how you launched the shell.
Can You Close WSL from Task Manager?
Task Manager can show processes associated with WSL, but it is usually better to shut WSL down with the official command. Selective termination of system processes can interrupt Linux applications or leave the environment in an unexpected state. Use wsl --shutdown or wsl --terminate to stop WSL cleanly.
If a WSL-related process appears in Task Manager after you have run the shutdown command, give Windows a short time to finish stopping the environment. Also check whether another application has started a distribution again. A process appearing briefly does not necessarily mean your files or installation are damaged.
WSL Will Not Close: Troubleshooting Tips
If WSL does not appear to stop, try these steps in order:
-
Confirm the command. Run
wsl --shutdownfrom PowerShell or Command Prompt, rather than relying only on closing a terminal window. -
Check the running distributions. Use
wsl --list --runningto see whether a distribution is still active. -
Stop a specific distribution. Run
wsl --terminate DistributionNameusing the exact name shown bywsl --list --verbose. - Close applications that use WSL. Editors, development tools, container software, and Linux services can launch or use a distribution in the background.
- Wait briefly and check again. Some processes may take a moment to stop. Run the status command again after a short pause.
- Restart Windows if necessary. If WSL remains unresponsive, restarting Windows can clear a stuck environment. Save your work before restarting.
If commands such as wsl --shutdown are not recognized, check that WSL is installed and that your Windows version supports the command. Open Windows Update and install available updates if WSL commands or behavior seem outdated. You can check your Windows version by opening Settings and selecting System, then About.
Closing WSL Is Not the Same as Uninstalling It
Shutdown commands stop a running WSL environment; they do not remove it. Avoid using wsl --unregister to close a distribution. Unregistering removes that distribution and deletes its stored Linux files, so it is a destructive action rather than a normal shutdown method. Use wsl --shutdown or wsl --terminate for routine closing.
Conclusion
The easiest way to close WSL in Windows is to run wsl --shutdown in PowerShell or Command Prompt. This stops all running distributions and shuts down the WSL 2 virtual machine without deleting your Linux files. To close only one environment, check its name with wsl --list --verbose and run wsl --terminate DistributionName. Typing exit or closing Windows Terminal may end a shell session, but background processes can keep WSL active. Choose the command that matches what you want to stop, save your work, and verify the result with wsl --list --running.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.