WSL (Windows Subsystem for Linux) is a feature in Windows 10 and 11 that allows you to run a full Linux environment directly on Windows, without needing a virtual machine or dual boot.
There are two versions:
/mnt/c
) and Linux (\\wsl$
).wsl --install
By default, installs WSL 2 with Ubuntu (in Windows 11 and newer Windows 10 builds).
To install a specific distro:
wsl --install -d <DistributionName>
Example:
wsl --install -d Debian
Command | Description | |
---|---|---|
wsl --list / wsl -l |
List installed distributions | |
wsl --list --verbose / wsl -l -v |
List distros with version info | |
`wsl --set-default-version <1 | 2>` | Set default WSL version |
`wsl --set-version <1 | 2>` | Change version of a distro |
wsl --set-default <DistroName> |
Set default distro | |
wsl -d <DistroName> |
Run a specific distro | |
wsl --terminate <DistroName> / wsl --shutdown |
Stop a distro or shut down all | |
wsl --unregister <DistroName> |
Completely remove a distro (with all data) | |
wsl --import <DistroName> <InstallLocation> <TarFile> |
Import a distro from a .tar backup |
|
wsl --export <DistroName> <TarFile> |
Export a distro to a .tar backup file |
Export (backup):
wsl --export Ubuntu D:\Backups\ubuntu_backup.tar
Import (restore or custom install):
wsl --import Ubuntu_Custom D:\WSL\Ubuntu_Custom D:\Backups\ubuntu_backup.tar --version 2
Explanation:
Ubuntu_Custom
→ New distro nameD:\WSL\Ubuntu_Custom
→ Path where distro’s files will be storedubuntu_backup.tar
→ Backup file--version 2
→ Use WSL 2/mnt/c
→ Windows C: drive/mnt/d
→ Windows D: drive\\wsl$\Ubuntu
→ Ubuntu’s Linux filesystemwsl --update
→ Update WSL to the latest version.wsl --status
→ Check WSL version and configuration.wsl --import ubuntu24 C:\wsl\ubuntu24 C:\wsl\ubuntu-noble-wsl-amd64-24.04lts.rootfs.tar.gz --version 2