Even if you leave your WSL Linux session, it remains active. This allows you to quickly return where you left off (requires a terminal multiplexer like screen or tmux), or run a daemon/server. Here's how to terminate a running WSL Linux distro if you really need it.
The ability to run Linux natively in Windows 10 is provided by the WSL feature. WSL stands for Windows Subsystem for Linux, which initially, was limited to Ubuntu only. Modern versions of WSL allow installing and running multiple Linux distros from Microsoft Store.
After enabling WSL, you can install various Linux versions from the Store. You can use the following links:
Find Running WSL Linux Distros
Starting with Windows 10 build 17046, Windows Subsytem for Linux (WSL) has got support for long-running background tasks, similar to how the Windows subsystem has Services. This is a really impressive change for users of WSL who work with servers like Apache or apps like screen or tmux. Now they can run in the background like regular Linux daemons. This, and a number of others, are reasons to have an active WSL instance in Windows 10.
Even when you issue the
exit command, this doesn't turn off your WSL distro. Starting in Windows 10 build 18836 you can see running distros using a new Linux entry in the Navigation pane. Click on the Distros shortcut in the Linux folder to see all currently running WSL distros.
Alternatively, you can open a new command prompt and execute the command
wsl.exe --list --running to see currently active instances of WSL.
To terminate a Running WSL Linux Distro in Windows 10,
- Open a new command prompt.
- Type the following command:
wsl --terminate <DistributionName>. Alternatively, you can use this shorten syntax:
wsl -t <DistributionName>. Substitute the <DistributionName> portion with the name of the WSL distro you want to terminate.
- The WSL Distro is now terminated.
Terminated WSL distros do not appear under the Linux item and the wsl$ share in File Explorer. They are not listed in the
wsl --list --running command output. To see them, execute the command
wsl --list --all.
To start a terminated WSL distro, use the command
wsl --distribution <DistributionName>
Substitute the <DistributionName> portion with the name of the terminated WSL distro.
Articles of interest:
- Remove Linux from Navigation Pane in Windows 10
- Export and Import WSL Linux Distro in Windows 10
- Access WSL Linux Files from Windows 10
- Windows 10 Build 18836 Shows WSL/Linux File System in File Explorer
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
I tried to execute the command with Admin rights on the Powershell, but I get the error: The system cannot find the file specified.