Windows Subsystem for Linux (WSL) allows Linux distributions to run directly on Windows while remaining easy to control from PowerShell. For routine administration, most operations can be completed with the built-in wsl command without opening the Linux environment first.
This article collects the PowerShell commands that are most useful for starting, stopping, inspecting, updating, and troubleshooting WSL.
Starting WSL
The simplest command is:
wsl
This launches the default Linux distribution using its default user.
One detail is worth noting: WSL normally inherits the current Windows working directory. For example, if PowerShell is currently inside a Windows user directory, WSL may start under a path such as:
/mnt/c/Users/...
To start directly in the Linux user’s home directory instead, use:
wsl ~
Microsoft officially supports ~ for this purpose.
For interactive use, wsl ~ is often more convenient than plain wsl.
Listing Installed Distributions
To see all installed WSL distributions:
wsl --list
or:
wsl -l
For more useful information, including whether each distribution is running and whether it uses WSL 1 or WSL 2:
wsl --list --verbose
The shorter form is:
wsl -l -v
Typical output resembles:
NAME STATE VERSION
* Ubuntu Running 2
Debian Stopped 2
The * marks the default distribution. Microsoft documents -l -v as the standard way to inspect installed distributions and their WSL versions.
Checking Which Distributions Are Running
To display only currently running distributions:
wsl --list --running
This is especially useful after closing a terminal window, because closing the shell does not necessarily mean that the WSL virtual machine has already stopped.
If everything has stopped, Windows reports that there are no running distributions.
This command is also useful when troubleshooting configuration changes or checking whether wsl --shutdown succeeded.
Starting a Specific Distribution
If multiple distributions are installed, a particular one can be launched with:
wsl --distribution <DistributionName>
The short form is:
wsl -d <DistributionName>
For example:
wsl -d Ubuntu
The actual distribution names should always be checked first with:
wsl -l -v
This avoids assuming that a distribution has a particular registered name.
Starting WSL as a Specific Linux User
A distribution can also be started as a particular Linux user:
wsl --user <Username>
For example, an administrative shell can be started with:
wsl --user root
A particular distribution and user can be specified together:
wsl --distribution <DistributionName> --user <Username>
Microsoft documents both forms as supported ways to select the Linux account used when launching WSL.
Running a Linux Command Directly from PowerShell
WSL does not have to be opened interactively just to execute one Linux command.
For example:
wsl uname -a
or:
wsl ls -la
The command runs inside the default Linux distribution and returns its output directly to PowerShell.
A command can also be directed to a specific distribution:
wsl -d <DistributionName> uname -a
This is particularly useful for scripts and quick diagnostics.
Completely Shutting Down WSL
One of the most useful administration commands is:
wsl --shutdown
This immediately terminates all running WSL distributions and shuts down the WSL 2 lightweight virtual machine.
This differs from simply typing:
exit
inside Linux.
exit closes that shell session. It does not necessarily shut down the entire WSL environment.
Therefore, when the goal is to completely stop WSL, use:
wsl --shutdown
It only needs to be executed once.
A useful verification command is:
wsl --list --running
The combination:
wsl --shutdown
wsl --list --running
is a quick way to confirm that WSL has fully stopped.
Restarting WSL
WSL does not require a separate restart command.
A clean restart can be performed with:
wsl --shutdown
wsl
or, to start in the Linux home directory:
wsl --shutdown
wsl ~
This is useful after changing .wslconfig, recovering from an abnormal startup, or resetting the WSL 2 virtual-machine environment.
Microsoft specifically describes wsl --shutdown as a fast way to restart the WSL 2 environment.
Stopping Only One Distribution
If several distributions are running and only one needs to be stopped:
wsl --terminate <DistributionName>
For example:
wsl --terminate Ubuntu
The abbreviated form is also commonly available:
wsl -t Ubuntu
This terminates only the selected distribution instead of shutting down all of WSL.
Microsoft distinguishes this from wsl --shutdown: --terminate targets one distribution, while --shutdown stops all distributions and the WSL 2 VM.
Checking WSL Status
To inspect the general WSL configuration:
wsl --status
This can show information such as the default distribution, default WSL version, and kernel-related configuration.
It is one of the first commands worth checking when diagnosing WSL behavior.
Checking the Installed WSL Version
To display WSL and component versions:
wsl --version
Depending on the installed WSL package, the output may include versions for components such as WSL itself and the Linux kernel. Microsoft documents this separately from wsl --status.
For troubleshooting, these three commands provide a useful overview:
wsl --version
wsl --status
wsl -l -v
Together they show the WSL software version, general configuration, installed distributions, current state, and whether each distribution uses WSL 1 or WSL 2.
Updating WSL
WSL itself can be updated from PowerShell:
wsl --update
Microsoft documents this as the standard command for updating WSL to the latest available version.
After an update, shutting WSL down before starting it again can be useful:
wsl --shutdown
wsl
Setting the Default Distribution
When several Linux distributions are installed, the default can be changed with:
wsl --set-default <DistributionName>
For example:
wsl --set-default Ubuntu
Afterward, simply running:
wsl
launches that distribution by default.
Setting the Default WSL Version
To make newly installed distributions use WSL 2 by default:
wsl --set-default-version 2
Existing distributions are not automatically converted by this command.
To change an existing distribution:
wsl --set-version <DistributionName> 2
Conversion between WSL 1 and WSL 2 can take considerable time, especially for large distributions, so Microsoft recommends backing up important data before performing such a conversion.
Checking Available Distributions
To see distributions available for installation:
wsl --list --online
or:
wsl -l -o
A distribution can then be installed with:
wsl --install -d <DistributionName>
Microsoft’s current WSL tooling also supports:
wsl --install
for installing WSL together with the default Linux distribution on supported Windows systems.
Exporting a WSL Distribution
WSL provides a built-in backup mechanism.
A distribution can be exported to a TAR archive:
wsl --export <DistributionName> <BackupFile.tar>
For example:
wsl --export Ubuntu D:\Backup\ubuntu-backup.tar
This creates a portable snapshot containing the distribution’s filesystem. Microsoft also supports VHD-based export for WSL 2.
Importing a Distribution
An exported TAR file can be restored or registered as another distribution:
wsl --import <DistributionName> <InstallLocation> <BackupFile.tar>
For example:
wsl --import LinuxBackup D:\WSL\LinuxBackup D:\Backup\linux-backup.tar
This makes export/import useful not only for backups but also for moving WSL distributions between storage locations.
Removing a Distribution
A registered distribution can be permanently removed with:
wsl --unregister <DistributionName>
This command requires particular care.
Unlike --terminate or --shutdown, --unregister deletes the distribution’s registered filesystem, installed software, configuration, and user data. Microsoft explicitly warns that the associated data is permanently lost after unregistering the distribution.
Therefore:
wsl --terminate Ubuntu
means:
Stop Ubuntu.
while:
wsl --unregister Ubuntu
means:
Delete the Ubuntu WSL instance.
The two commands should never be confused.
Displaying WSL Help
When an option needs to be checked directly:
wsl --help
This displays the commands supported by the installed WSL version.
Because WSL continues to evolve, wsl --help is also useful for checking whether a newer option exists on a particular Windows installation.
A Practical Command Set
For normal daily administration, only a small subset needs to be remembered:
# Start the default distribution
wsl
# Start in the Linux home directory
wsl ~
# Show installed distributions and their status
wsl -l -v
# Show only running distributions
wsl --list --running
# Start a particular distribution
wsl -d <DistributionName>
# Start as a particular Linux user
wsl -u <Username>
# Stop one distribution
wsl --terminate <DistributionName>
# Completely shut down WSL
wsl --shutdown
# Check WSL configuration
wsl --status
# Check WSL version
wsl --version
# Update WSL
wsl --update
# Show available commands
wsl --help
Among these, the most useful troubleshooting sequence is often simply:
wsl --shutdown
wsl
If WSL exhibits an abnormal startup, networking problem, stale configuration, or temporary virtual-machine state, this performs a clean restart without rebooting Windows.
WSL Commands and PowerShell Commands Are Different
One conceptual distinction helps avoid confusion.
When entered in PowerShell:
wsl
is a Windows-side command that launches or controls WSL.
After entering the Linux shell:
systemctl status
journalctl
ip addr
ps aux
are Linux-side commands executed inside the distribution.
If a WSL management command needs to be invoked from inside Linux, Microsoft documents using the Windows executable name:
wsl.exe --status
rather than simply:
wsl --status
This distinction becomes particularly useful when switching frequently between PowerShell and Bash.
Conclusion
WSL can be managed almost entirely from PowerShell without interacting with Windows services or manually controlling its underlying virtual machine.
For routine use, four commands cover most situations:
wsl
wsl -l -v
wsl --shutdown
wsl --status
wsl starts the Linux environment, wsl -l -v shows what exists and what is running, wsl --shutdown cleanly resets the entire WSL environment, and wsl --status provides a quick configuration overview.
For systems that use WSL regularly, knowing these commands makes starting, stopping, inspecting, and recovering WSL considerably simpler while avoiding unnecessary Windows reboots.