Windows Subsystem for Linux (WSL) CLI Cheat Sheet
Basic Commands
Installation
Open PowerShell in administrator mode by right-clicking and selecting "Run as administrator", enter the wsl --install command, then restart your machine
List available Linux distributions
See a list of the Linux distributions available through the online store
List installed Linux distributions
List your installed Linux distributions, including state and the version of WSL running the distribution
List only distributions that are currently running
Change the default Linux distribution installed
To change the distribution installed, enter:
Replace
Run a specific WSL distribution
To run a specific wsl distribution from within PowerShell without changing your default distribution, use the command:
Set default Linux distribution
Set the default Linux distribution that WSL commands will use to run
Update WSL
Update your WSL version to the latest version
Check WSL version
Check the version information about WSL and its components
Check WSL status
See general information about your WSL configuration
Shutdown
Immediately terminate all running distributions and the WSL 2 lightweigth utility virtual machine
Terminate
Terminate a specified distribution
Unregister or uninstall a Linux distribution
Unregister and uninstall a WSL distribution
Import a distribution
Imports the specified tar file as a new distribution
Export a distribution
Exports a snapshot of the specified distribution as a new distribution file