Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

How to Find Your WSL 2 Profile ID (GUID)

how-to-find-your-wsl-2-profile-id-guid.jpg

I ended up having a few WSL instances with the same name listed in my Microsoft Terminal config and wanted to find the real one.

Quick Jump:

While switching over to Arch Linux within WSL 2 I ended up creating and deleting a few WSL instances but they all had the same name.

I ended up with a bunch of duplicate entries in my Microsoft Terminal config that looked like this, except the guid was different for each one:

  "profiles": {
    "list": [
      {
        "guid": "{a9741877-f895-512d-a385-bb120648fbbe}",
        "hidden": false,
        "name": "Arch Linux",
        "source": "Microsoft.WSL"
      }
    ]
  }

What I wanted to do was set the last one I created as my default profile. That’s easy enough by setting "defaultProfile": "{a9741877-f895-512d-a385-bb120648fbbe}".

But, I wasn’t sure which GUID to use. I am pretty sure the last item in the list aligns with the latest instance you created but if you wanted to know for sure or maybe you’re not sure of the order and you want to pick one from the middle you can find that out.

In your WSL instance you can run:

$ echo $WT_PROFILE_ID
{a9741877-f895-512d-a385-bb120648fbbe}

I ended up finding this by running env and looking through the list of environment variables that were defined. It’s a quick way to get your profile ID.

# Demo Video

Timestamps

  • 0:18 – I wanted to find it to configure the Microsoft Terminal

Did you end up using this method to find your profile ID? Let me know below.

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per year (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.



Comments