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 must 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.
Ex.
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.
wsl --shutdown
The commands above will shut down or terminate all Linux distributions.
That should do it!
Conclusion:
- Windows Subsystem for Linux (WSL) on Windows 11 allows developers to run a GNU/Linux environment directly in Windows without needing a virtual machine or dual-boot setup.
- Terminate a specific Linux system on Windows 11 using WSL by running the command
wsl -t Linux-machine-name
in Command Prompt or Windows PowerShell as an administrator. - To shut down all Linux systems’ services running in the background, use the command
wsl --shutdown
.
Leave a Reply