$ | >

Map WSL process ID to Windows process ID

Currently there appears no clean way to get the corresponding Windows process ID of a running WSL process. I can inspect the PIDs of running processes in Windows taskmanager or with the tasklist command from bash on WSL as in:

oeffner@grove:~$ cmd.exe /c tasklist

But that does not guarantee unambiguous identification PIDs if more processes have the same name.

It would be great if the PID of a WSL process was available as an additional column for Windows TaskManager and the tasklist command.

It would also be great if it were possible under WSL to get the corresponding Windows PID of a running WSL process.

42 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Robert Oeffner shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Robert Oeffner commented  ·   ·  Flag as inappropriate

        On a related note, WSL does not seem able to properly control win32 binaries that have been started from WSL. If notepad is started under WSL and then later killed from WSL that still leaves notepad running. This complicates writing bash scripts interacting both with Linux and with win32 binaries; the result of checking for a running win32 process with say the Linux "pidof" command cannot be trusted.

      Feedback and Knowledge Base