Uninstallation of redundant or unused Linux Distros on Windows Subsystem for Linux (WSL) is an important activity to reclaim space and maintain hygiene of the system.  It is just one command to remove a distro from WSL.

Video:

  • Run the following command in Windows Command Prompt to find the list of installed Linux distributions.
C:\Users\AwsJunkie>wsl -l -v
  NAME           STATE           VERSION
* Ubuntu         Stopped         2
  MyUbuntuEnv    Stopped         2
  OldEnv         Stopped         2

  • Copy the name of the Linux Distro (e.g. "OldEnv") that we want to uninstall.
  • Execute wsl --unregister <Distro> to unregister the Linux Distribution and delete the root filesystem.
C:\Users\AwsJunkie>wsl --unregister OldEnv
Unregistering...

C:\Users\AwsJunkie>wsl -l -v
  NAME           STATE           VERSION
* Ubuntu         Stopped         2
  MyUbuntuEnv    Stopped         2

Please let me know in the comment section below how frequently do you clean up your development environment? Thanks.

References