Getting Started with WSL on Windows: Install, Manage, and Remove Linux Distros

#WSL#Windows#Linux#Devops#Ubuntu
Getting Started with WSL on Windows: Install, Manage, and Remove Linux Distros

WSL on Windows: A Complete Guide to Installation, Management, and Uninstallation

If you're a Windows user who wants access to a full Linux environment without the overhead of a traditional virtual machine, Windows Subsystem for Linux (WSL) is one of the best solutions available.

WSL allows you to run Linux distributions directly alongside Windows, giving you access to Linux tools, shells, package managers, development environments, Docker, and DevOps tooling without maintaining a separate virtual machine.

In this guide, you'll learn how to:

  • Install WSL and Ubuntu

  • Check and manage installed Linux distributions

  • Install multiple distributions such as Ubuntu and Kali Linux

  • Change the default WSL distribution

  • Completely remove a Linux distribution

  • Perform a clean uninstall of WSL


What Is WSL?

Windows Subsystem for Linux (WSL) is a Windows feature that allows you to run Linux distributions directly on Windows.

With WSL 2, Linux runs using a lightweight virtualized environment that provides much better compatibility with Linux applications while remaining deeply integrated with Windows.

Compared with a traditional virtual machine, WSL is generally:

  • Faster to start

  • Simpler to manage

  • Lightweight

  • Well integrated with Windows

  • Excellent for development and DevOps workflows

WSL is commonly used for:

  • Software development

  • Linux administration

  • Docker and containers

  • DevOps

  • Cloud tooling

  • Programming

  • Learning Linux

  • Running Linux command-line applications


Installing WSL

The easiest way to install WSL is through PowerShell or Command Prompt.

1. Open PowerShell as Administrator

Open Windows PowerShell or Command Prompt with administrator privileges.

Then run:

powershell
wsl --install

This command automatically installs and enables the required components, including:

  • Windows Subsystem for Linux

  • Virtual Machine Platform

  • WSL 2

  • Ubuntu, by default

Restart Windows if you are prompted to do so.

After restarting, Ubuntu will complete its initial setup. You'll then be asked to create a Linux username and password.


Check Your Installed WSL Distributions

To see the Linux distributions installed on your computer, run:

powershell
wsl --list

For additional information, including the WSL version:

powershell
wsl --list --verbose

or:

powershell
wsl -l -v

You might see something similar to:

text
NAME              STATE           VERSION
Ubuntu            Running         2
docker-desktop    Stopped         2

The VERSION column tells you whether the distribution is running under WSL 1 or WSL 2.


Installing Ubuntu

If Ubuntu wasn't installed automatically, you can install it explicitly:

powershell
wsl --install -d Ubuntu

You can also install a specific Ubuntu release if it is available on your system:

powershell
wsl --install -d Ubuntu-22.04

After installation:

  1. Open Ubuntu from the Windows Start Menu.

  2. Wait for the initial setup to complete.

  3. Create your Linux username.

  4. Create your Linux password.

Your Ubuntu environment is now ready to use.


Installing Kali Linux

WSL also allows you to install multiple Linux distributions side by side.

For example, to install Kali Linux:

powershell
wsl --install -d kali-linux

Once installation is complete, launch Kali Linux from the Start Menu and complete its initial setup.

You can now have Ubuntu and Kali installed simultaneously without needing separate virtual machines.


Managing Multiple Linux Distributions

To see all available distributions that can be installed, run:

powershell
wsl --list --online

This displays the distributions supported by WSL on your system.

For example:

text
NAME
Ubuntu
Debian
kali-linux
openSUSE

The exact list may vary depending on your Windows and WSL version.


Setting the Default WSL Distribution

When you run:

powershell
wsl

Windows launches your default WSL distribution.

For example, to make Ubuntu the default:

powershell
wsl --set-default Ubuntu

To make Kali Linux the default:

powershell
wsl --set-default kali-linux

You can verify the default distribution with:

powershell
wsl --list

The default distribution is marked accordingly.

Important

Changing the default distribution does not delete or modify the other distributions.

It simply determines which distribution opens when you run:

powershell
wsl

Deleting a Linux Distribution

If you want to completely remove a WSL distribution, use:

powershell
wsl --unregister Ubuntu

For Kali:

powershell
wsl --unregister kali-linux

If your Ubuntu installation has a different name, first check:

powershell
wsl -l -v

For example, if the distribution is called

Code
Ubuntu-24.04
:

powershell
wsl --unregister Ubuntu-24.04

⚠️ Warning

Code
wsl --unregister
permanently deletes the distribution and all files stored inside it.

This includes:

  • Installed applications

  • Linux user accounts

  • Configuration files

  • Home-directory files

  • Development environments

  • Databases

  • Projects stored inside that distribution

Make sure you have backed up anything important before unregistering it.


Completely Removing WSL

If you want to remove WSL itself from Windows, first remove the Linux distributions you no longer need.

For example:

powershell
wsl --unregister Ubuntu

Then unregister any other distributions you have installed.

After that, disable the Windows features used by WSL.

Run PowerShell as Administrator and execute:

powershell
dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart

Then:

powershell
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart

Restart Windows afterward.

WSL and its underlying Windows components will then be disabled.

Note: If you use Docker Desktop, be careful when disabling WSL or Virtual Machine Platform because Docker Desktop commonly relies on WSL 2.


Reinstalling Ubuntu After Removal

If you previously removed Ubuntu and want a fresh installation, you can install it again with:

powershell
wsl --install -d Ubuntu

After installation, launch Ubuntu and complete the Linux user setup.

Then, if you want Ubuntu to be the distribution launched by default:

powershell
wsl --set-default Ubuntu

You can confirm everything with:

powershell
wsl -l -v

You should see Ubuntu listed with VERSION 2.


Useful WSL Commands

Here are some of the most useful commands to keep handy:

|Command|Purpose| |---|---| |

Code
wsl
|Start the default Linux distribution| |
Code
wsl -l -v
|List installed distributions and versions| |
Code
wsl --list --online
|Show available distributions| |
Code
wsl --install -d Ubuntu
|Install Ubuntu| |
Code
wsl --set-default Ubuntu
|Make Ubuntu the default| |
Code
wsl --shutdown
|Shut down all running WSL instances| |
Code
wsl --terminate Ubuntu
|Stop a specific distribution| |
Code
wsl --unregister Ubuntu
|Permanently remove a distribution|


Ubuntu vs. Kali Linux on WSL

You can run both Ubuntu and Kali Linux on the same Windows installation, but they serve different purposes.

Ubuntu

Best suited for:

  • General Linux usage

  • Programming

  • Development

  • Servers

  • Docker

  • DevOps

  • Cloud tooling

Kali Linux

Primarily designed for:

  • Security testing

  • Digital forensics

  • Penetration testing

  • Security research

  • Cybersecurity training

For general development and server-style workloads, Ubuntu is usually the better starting point.


Final Thoughts

WSL provides a powerful middle ground between Windows and Linux.

You get the convenience of Windows while still having access to a genuine Linux environment and its extensive ecosystem of tools.

With WSL 2, you can:

  • Run multiple Linux distributions

  • Switch between distributions

  • Use Linux development tools

  • Run Docker and containers

  • Access Windows files from Linux

  • Access Linux files from Windows

  • Build development and DevOps environments without maintaining a traditional VM

For most Windows users who need Linux for development, automation, servers, or learning, WSL 2 with Ubuntu is an excellent setup.