Script Valley
Developer Environment Setup (WSL, Terminal, VS Code)
Understanding WSL2 and Why It ExistsLesson 1.4

How to install and switch between Linux distros in WSL2

wsl --list --online, wsl --install -d, default distro, wsl --set-default, running multiple distros, wsl --terminate, wsl --unregister

Managing Distros in WSL2

Multiple WSL2 distros diagram

WSL2 supports multiple Linux distributions running in parallel. You can have Ubuntu for web projects and Debian for a stricter environment, both active at the same time.

Listing available distros

wsl --list --online

This pulls the current list from Microsoft. Common options include Ubuntu (22.04, 24.04), Debian, Kali Linux, and openSUSE.

Installing a specific distro

wsl --install -d Debian

Run this in PowerShell. The distro downloads and launches a setup prompt for your Linux username and password.

Listing installed distros and their WSL version

wsl --list --verbose
# NAME           STATE   VERSION
# Ubuntu         Running 2
# Debian         Stopped 2

Switching the default distro

wsl --set-default Debian

After this, typing wsl in PowerShell drops you into Debian.

Stopping and removing distros

# Stop a running distro
wsl --terminate Ubuntu

# Remove a distro entirely (destructive โ€” deletes all files)
wsl --unregister Ubuntu

--unregister is permanent. Export a backup first if you have work inside: wsl --export Ubuntu ubuntu-backup.tar

Up next

How to update and maintain your WSL2 installation

Sign in to track progress

How to install and switch between Linux distros in WSL2 โ€” Understanding WSL2 and Why It Exists โ€” Developer Environment Setup (WSL, Terminal, VS Code) โ€” Script Valley โ€” Script Valley