How to shutdown Linux distros on WSL

If you use WSL, you can use a couple of commands to shut down one or all Linux distros manually, and here's how.

WSL 2 shutdown Linux distros
WSL 2 shutdown Linux distros

Although the Windows Subsystem for Linux (WSL) is a convenient way to run Linux distros alongside Windows 11 or Windows 10, the lightweight virtual machine will continue to run in the background even when you exit the command shell, wasting system resources.

If you prefer to terminate the Linux distro (Ubuntu, Kali, Debian, Mint, etc.) as soon as you are done using it or have to restart it, use a wsl.exe command-line tool to shut down one or all distributions manually.

This guide will teach you the steps to shut down Linux distros running on the WSL2 platform on Windows 10 and 11.

Terminate a Linux distro on WSL

To terminate a Linux distro on WSL running on Windows 11 or Windows 10, use these steps:

  1. Open Start.

  2. Search for Command Prompt (or PowerShell), right-click the top result, and select the Run as administrator option.

  3. Type the following command to view all running WSL distros and press Enter:

    wsl --list --verbose
  4. Type the following command to shut down the Linux distro on Windows 11 or Windows 10 and press Enter:

    wsl -t DISTRO-NAME

    WSL terminate Linux distro command

    In the command, replace DISTRO-NAME with the name of the distro you want to shut down, as shown in step 3. For example, wsl -t Ubuntu-20.04.

  5. (Optional) Type the following command to confirm the distro is “stopped” and press Enter

    wsl --list --verbose

Once you complete the steps, the distro running on the Windows Subsystem for Linux will gracefully shut down. You can always repeat the steps to terminate other distros or use the steps below to shut them all down.

Terminate all Linux distros on WSL

To shut down all the WSL distros running on Windows 10 (or 11), use these steps:

  1. Open Start.

  2. Search for Command Prompt (or PowerShell), right-click the top result, and select the Run as administrator option.

  3. Type the following command to view all running WSL distros and press Enter:

    wsl --list --verbose
  4. Type the following command to shut down the Linux distributions running on Windows and press Enter:

    wsl --shutdown

    WSL shutdown all Linux distros command

  5. (Optional) Type the following command to confirm the distros are “stopped,” and press Enter:

    wsl --list --verbose

After you complete the steps, all the WSL distros will terminate immediately on Windows 11 or 10.

If you need to restart the Linux distro, spin it again from the Start menu, or use Command Prompt or PowerShell and run the wsl --distribution DISTRO-NAME command (replace the DISTRO-NAME with the actual name of the distro before running the command).

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].