How to Restart WSL using PowerShell, CMD, Task Manager
WSL or Windows Subsystem Linux is a built-in feature that helps run a Linux environment on a Windows 10/11 machine without using any dual-boot setup or virtual machine. Restarting WSL can be a convenient and time-efficient way to reboot or reinitialize the Linux instance without booting the whole system. This article explores the various ways of restarting WSL, primarily through Windows PowerShell, Command-Prompt (CMD), and Task Manager.
How to Restart WSL using PowerShell, CMD, Task Manager
You can use any of the following methods to restart WSL on Windows.
- WSL Command
- Restart a specific Linux Distribution
- Through LxssManager Service
- Restart WSL using CMD
- Restart WSL from Task Manager
Make sure to save your work on any of the distros you are working on as it will close when you restart the WSL service.
1] WSL command
To restart WSL from Windows PowerShell, we use the WSL command with appropriate options. It is a Windows executable command that interacts with the WSL distributions.
- Type PowerShell after clicking on the Search icon on the Desktop.
- On the PowerShell prompt, press ENTER after typing:
wsl – shutdown
- You can start WSL again by clicking on the application icon on the Desktop or searching it on the Start menu.
The wsl –shutdown terminates all the active WSL distributions or instances currently running on the physical system or device. There can be multiple distributions of WSL, like Ubuntu, Debian, Kali, etc., installed on the computer that can all be simultaneously shut down and restarted through the abovementioned steps.
Read: WSL is not working or starting in Windows
2] Restart a specific Linux Distribution
In case a system has multiple WSL distributions installed, and we need to restart a specific distribution, the below-mentioned steps can be executed from the PowerShell:
- Open the Windows PowerShell Terminal window.
- Enter the below-mentioned commands in the same sequence as mentioned below,
wsl –l –v wsl –t Debian wsl – d Debian
In the first command:
- -l option lists all the installed distributions or distros.
- –v is an optional switch that can list the additional details, like the version number and status (running or stopped) of the distribution/s installed.
Once the distros are listed, execute the wsl command again with the –t(terminate) option followed by the name of the distribution shutdown of the specific distro. The 2nd command terminates the WSL distribution named Debian.
Once the specific distro is shut down, it can be restarted again using the –d switch with the wsl command followed by the distro name, as shown in the 3rd command above.
3] Through LxssManager Service
The LxssManager is a user-mode session manager service that launches or terminates a new session or instance of the WSL when executed. Restarting the LxssManager service from the PowerShell would allow a WSL session to close and then boot up once again by executing the below-mentioned command from the PowerShell prompt:
restart –Service LxssManager
Restart-Service: restarts a specific service (LxssManager, in this case).
LxssManager: is the service name for which the information needs to be retrieved.
Read: WSL is not working or starting in Windows
4] Restart WSL using CMD
While restarting WSL through the command prompt or Windows terminal, no specific services or commands are available to do the same. Restarting WSL, primarily through Command Prompt, involves stopping and starting either the process or service, LxssManager or WslService. To do so:
- Click on the Search icon on the Desktop and type CMD.
- Once the Command Prompt appears in the search result, click the Run as Administrator option.
- Type the below-mentioned command in the same order as mentioned below:
net stop LxssManager net start LxssManager
5] Restart WSL from Task Manager
Restarting WSL from Task Manager involves restarting the concerned LxssManager service by following the below-mentioned methods:
- Open the Task Manager by pressing CTRL+SHIFT+ESC.
- Click on the Services Tab and the Open Service option at the bottom.
- Locate the LxssManager service.
- Right-click on the service and click Restart.
I hope the post was easy to follow and that you now know how to restart WSL using PowerShell, CMD, and Task Manager.
How do I reset my WSL?
Any distribution available on Windows PC is like an app. You can go to the Apps section in the settings, find the WSL, and then choose to reset using the advanced options.
How do I enable WSL?
Open the Start menu, type Windows features into the search bar, and click on Turn Windows Features On or Off. Select the “Windows Subsystem for Linux” checkbox and press OK.