Skip to content

Instantly share code, notes, and snippets.

@danawesome
Created June 9, 2025 22:49
Show Gist options
  • Select an option

  • Save danawesome/84a1f0a38f238c3aa9b9a66524e3a3c0 to your computer and use it in GitHub Desktop.

Select an option

Save danawesome/84a1f0a38f238c3aa9b9a66524e3a3c0 to your computer and use it in GitHub Desktop.
WSL Cliff's Notes

Open PowerShell as Administrator

In order to work on WSL, first shutdown (if nothing is running) wsl --shutdown wsl --manage debian --set-default-user root - Sets root as default in order to be able to change the password or other things on the regular account

Install distro without MS Store wsl --install -d debian

Get a list of distros wsl --list --online

Get a list of installed distros wsl --list

Move Distro to another location to save drive space (make the location first!) wsl --manage debian --move E:\WSL\Debian

Set default Distro wsl -s debian

  1. Revert sparse mode wsl --manage --set-sparse false
  2. Optimize the disk optimize-vhd -Path .vhdx -Mode full
  3. Set it back to sparse mode wsl --manage --set-sparse true

Reset the root password wsl -d debian -u root - Set distro to root user, if only one distro wsl -u root will work. pwsswd - use to change the password for root exit - exit wsl and return to windows

Remove a Distro that isn't visible in Settings>Apps>Installed apps - or any distro wsl --unregister debian - Removes the distro and the folder it was in

Backing up and Restoring Distros wsl --export <filename.tar> wsl --import </filename.tar>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment