This article describes the steps to shut down or terminate a Ubuntu Linux OS on Windows 11 using Windows Subsystem for Linux (WSL).
Windows Subsystem for Linux lets developers run a GNU/Linux environment directly in Windows without setting up a virtual machine or dual-boot, including most command-line tools, utilities, and applications.
When you run your favorite distributions with WSL and 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 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 want to shut down or terminate the machine altogether, 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.
wsl --list --verbose
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.
wsl -t Linux-machine-name
Replace the Linux machine name with the name of the Linux distribution.
wsl -t Ubuntu-20.04
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.
wsl --list --verbose
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!
This post showed you how to shut down or terminate Linux systems on Windows 11 with WSL. Please use the comment form below if you find any errors above or have something to add.