Microsoft’s Windows Subsystem for Linux version 2, better known as WSL2, lets developers run a Linux environment directly on Windows. You don’t need a traditional dual-boot or virtual machine setup. This means you can use Linux command-line tools right within your Windows 11 environment. In this guide, we’ll show you how to start, restart, or shut down WSL2 on your Windows 11 system.
Also see: How to Run CMD or PowerShell as SYSTEM in Windows 11
Page Contents
Starting WSL2
Before you can use WSL2, make sure it’s installed and enabled on your Windows 11 system. If it’s not yet installed, check out the Microsoft guide on how to do it.
Once WSL2 is set up, starting it is easy. Open the Command Prompt
or PowerShell
as an admin by right-clicking on the Start button and selecting either “Command Prompt (Admin)” or “PowerShell (Admin)”.
With your Command Prompt or PowerShell open, type in this command to get WSL2 started:
wsl
This opens up the default Linux distribution you’ve got installed. If you’ve got more than one and want to open a specific one, use the -d
flag and the name of the distribution. For Ubuntu, it looks like this:
wsl -d Ubuntu
Restarting WSL2
Want to give WSL2 a quick restart? Here are some ways to restart it on Windows 11:
- First, shut down WSL2 (we’ll talk about that later) and then fire it up as you did before.
- Give the LxssManager service a quick reset. Hit
Win + R
, typeservices.msc
, and press Enter.Find theLxssManager
service, right-click it, and hitRestart
. - Or, use PowerShell to restart the LxssManager service. Open PowerShell as an admin and run:
Get-Service LxssManager | Restart-Service
Shutting down WSL2
When you’re finished using the Linux environment, or if you need to restart it, you’ll need to shut down WSL2. Do this by opening Command Prompt
or PowerShell
as before, and typing:
wsl --shutdown
Shutting down WSL2 completely turns off the Linux part of your system. It’s a smart move to shut it down when you’re not using it to help your computer run smoother.
Linked issue: This App is Preventing Shutdown or Restart
Precautions before shutting down
Please know that shutting down WSL2 is like turning off a real computer. Anything you haven’t saved in Linux will be lost. So, make sure you’ve saved all your work and closed any programs you don’t want to stop suddenly.
Some final notes
Using WSL2 on your Windows 11 system feels like having two operating systems without the need to switch between them. Being able to start, restart, or shut down WSL2 as needed gives you the flexibility to use a Linux environment whenever you need it and save system resources when you don’t.
Getting these processes right is key to navigating the combined Windows and Linux environment. Always make sure to save your work before shutting down, like you would when turning off your computer. For the most current information, additional details, and help, always check the official Microsoft documentation.