Terminate Running WSL Linux Distro in Windows 10

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.

Linux Distros Microsoft Store Windows 10

After enabling WSL, you can install various Linux versions from the Store. You can use the following links:

  1. Ubuntu
  2. openSUSE Leap
  3. SUSE Linux Enterprise Server
  4. Kali Linux for WSL
  5. Debian GNU/Linux

and more.

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.

WSL Network Share

Alternatively, you can open a new command prompt and execute the command wsl.exe --list --running to see currently active instances of WSL.

List Of Running WSL Distros

To terminate a Running WSL Linux Distro in Windows 10,

  1. Open a new command prompt.
  2. 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.
  3. The WSL Distro is now terminated.

Terminate Running WSL Distro Windows 10

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.

Terminated WSL Distro Windows 10

To start a terminated WSL distro, use the command

wsl --distribution <DistributionName>

Substitute the <DistributionName>  portion with the name of the terminated WSL distro.

That's it.

Articles of interest:

Leave a Reply

Your email address will not be published. Required fields are marked *