Skip to content

Instantly share code, notes, and snippets.

@aronreisx
Created December 11, 2021 19:16
Show Gist options
  • Save aronreisx/2de3d04e35003e2a167c28525013ff58 to your computer and use it in GitHub Desktop.
Save aronreisx/2de3d04e35003e2a167c28525013ff58 to your computer and use it in GitHub Desktop.
How to rename WSL Distro on Windows
To rename WSL Distros on Windows follow the steps:
1. Stop all instances of WSL
On PowerShell run the command: wsl --shutdown
2. Open Registry Editor and go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
Each subfolder on Lxss represents a distro
3. Locate and rename the distro you want
Inside each distro folder you have the DistributionName, change it and click ok
4. Restart WSL service
Open PowerShell as Admin and run the command: Get-Service LxssManager | Restart-Service
All setted up. Run wsl -l to see the changes.
@tveyben
Copy link

tveyben commented Sep 5, 2024

Great - just what I needed, but did'nt find until now :-)
Just updated Ubuntu from 20.04 to 24.04.1 and got annoyed

BUT it's no longer correct - the correct steps (as of today 4/9-2024) for me (on Win10) is (changes start at step 4):

  1. Stop all instances of WSL
    On PowerShell run the command: wsl --shutdown

  2. Open Registry Editor and go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
    Each subfolder on Lxss represents a distro

  3. Locate and rename the distro you want
    Inside each distro folder you have the DistributionName, change it and click ok

  4. Go to Windows Terminal -> Settings ->[the Ubuntu distribution, EG 'Ubuntu-20.04'] -> Command line
    Change to reflect the new name
    EG 'wsl.exe -d Ubuntu-20.04' -> 'wsl.exe -d Ubuntu'

  5. Rename all shortcuts (if you have these - I do in Total Commander) to match the new path
    EG \\wsl$\Ubuntu-20.04\home\<me>\ -> \\wsl$\Ubuntu\home\<me>\

  6. Launch the distribution from Windows Terminal
    As a side effect this (re-)starts the WSL service

@luison
Copy link

luison commented Nov 7, 2024

Hi had to use "Get-Service WslService" instead.
Found here

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