WSL: Basic Commands

Windows Subsystem for Linux (WSL) is a feature released by Microsoft in 2016 that allows us to install and manage multiple Linux distributions on our local Windows computer with ease.

The latest versions of Windows comes with a set of built-in WSL commands that help us utilise Windows Subsystem for Linux. To install WSL we can simply run ‘wsl --install‘ in our PowerShell terminal, but for more detailed information on this see my page; Installing WSL.

Common WSL Commands

CommandDescription
wslLaunches the default WSL distribution.
wsl -lLists all the installed WSL distributions.
wsl -l -vLists all the installed WSL distributions and their versions.
wsl -s <distro_name>Sets the specified distribution as the default WSL distro.
wsl --set-default <distro_name>Sets the specified distribution as the default WSL distro.
wsl --set-version <distro_name> <version>Changes the WSL version of the specified distribution.
wsl --unregister <distro_name>Uninstalls the specified WSL distribution.
wsl --export <distro_name> <file>Exports the specified WSL distribution to a tar file.
wsl --import <distro_name> <install_location> <file>Imports a tar file into a new WSL distribution.
wsl --terminate <distro_name>Terminates the specified WSL distribution.
wsl --updateUpdates the specified WSL distribution to the latest version.
wsl -u <distro_name>Upgrades the specified WSL distribution to the latest version.
wsl --installInstalls a new WSL distribution from the Microsoft Store.

For more tips on using WSL and maintaining installed distros, check out the WSL Blog Posts here.

One thought on “WSL: Basic Commands

Leave a Reply

Your email address will not be published. Required fields are marked *