Windows Subsystem for Linux lets developers run a GNU/Linux environment, including most command-line tools, utilities, and applications directly in Windows without setting up a virtual machine or dual-boot. When you run your favorite distributions with WSL, and you simply exit the command shell or terminal, the underlying Linux environment will continue to run in the background and use your Windows resources. You can terminate the background Linux operating system services when you are done using the Linux environment. This can be done using the wsl.exe command from the command line in Windows.
How to terminate the Linux system on Windows 11 via WSL
As described above, when you run your favorite distributions when WSL, and you simply exit the command shell or terminal, the underlying Linux environment will continue to run in the background and use your Windows resources. Below is how to shut down or terminate a Ubuntu Linux on Windows 11 with WSL.
Terminate Linux system on Windows WSL
When you are done with a Linux system in a WSL environment, and you want to shut down or terminate the machine completely, you will have to use the wsl.exe command. First, open the Command Prompt or Windows PowerShell app as administrator, then run the commands below to list all the Linux systems running in the WSL environment. The commands above will list all the Linux systems running within the WSL environment. With the list handy, run the commands below to shut down a specific Linux system. Replace the Linux-machine-name with the name of the Linux distribution. Ex. The command above will shut down a specific Linux distribution when the name is specified with the commands. List the running system to confirm that the machine was terminated.
Terminate all Linux systems on Windows WSL
If you want to shut down all Linux systems’ services running in the background, the commands below will do that. The commands above will shut down or terminate all Linux distributions. That should do it! Conclusion: This post showed you how to shut down or terminate Linux systems on Windows 11 with WSL. If you find any error above or have something to add, please use the comment form below.