WSL icon indicating copy to clipboard operation
WSL copied to clipboard

PS command is not listing Windows processes

Open rrezino opened this issue 9 years ago • 12 comments

  • Your Windows build number: Microsoft Windows [Version 10.0.15063]

  • What you're doing and what's happening: When you use the PS command, it doesn't list the Windows processes

  • What's wrong / what should be happening instead: I should be able to see the Windows processes on the list as well

  • Strace of the failing command, if applicable: use command ps on ubuntu terminal

rrezino avatar May 15 '17 09:05 rrezino

@rrezino - Yes, it is, as expected.

sunjoong avatar May 15 '17 10:05 sunjoong

@rezzino: I guess it would help your case if you would provide a use case. E.g. do you need this functionality for your build setup to work?

MikeGitb avatar May 16 '17 08:05 MikeGitb

"Use case" -- fair question. Interesting though, Cygwin/MSYS2 has a -W option in their ps implementation, that includes Windows processes in the list. Presumably not for their health, but I couldn't tell you why exactly. Shrug. Could be for their health, I guess.

therealkenc avatar May 18 '17 00:05 therealkenc

Here's a use case. I have a Windows program that takes a while to run and uses memory. I want to use ps to monitor the process size via ps --pid <windows-pid> -o vsz= . I do this on Linux, but would like to use the same script to monitor the Windows processes.

Dr-Irv avatar Jul 06 '17 18:07 Dr-Irv

To be honest, I'd rather use windows tools to monitor windows processes, but I can understand your desire to use the same script everywhere.

MikeGitb avatar Jul 06 '17 18:07 MikeGitb

lacking this feature (ability to monitor windows processes) will prevent migration from cygwin for anything that needs to launch and control windows processes. I've got a couple of candidate applications that are preventing me from migrating.

philwalk avatar Mar 24 '18 18:03 philwalk

Call tasklist.exe inside WSL using interop. You can "launch and control" windows processes with ease with WSL (this is part of its charm). Bearing in mind that the PID namespace for the Windows process and your WSL processes will be different.

therealkenc avatar Mar 24 '18 19:03 therealkenc

when you "control", do you mean by using windows cli tools (e.g., taskkill.exe)?

philwalk avatar Mar 24 '18 19:03 philwalk

Yes. You aren't going to get Cygwin equivalence because Cygwin ps is not Linux ps (anymore than you can with say Real Linux in a VM). But you can invoke anything in Windows from a WSL instance, be it tasklist.exe, taskkill.exe, or notepad.exe with impunity using interop as of Creators Update 15063.

therealkenc avatar Mar 24 '18 20:03 therealkenc

I know this issue has been closed, but the proper solution to this had been if the microsoft windows processes had been presented as it's own namespace in the WSL, most of the GNU tools would have without modification been able to handle this and allowed computer users to get a full control of the game os too.

j-aho avatar Feb 21 '20 07:02 j-aho

I know there's tasklist and wmic but having to call these within a wsl linux distro means having to parse 2 more program ouput instead of just one. Making any custom script tools I create ( actually already have on cigwin ) more complex. Not all windows programs are launched from wsl!!

Ps yet another reason migrating from cygwin is proving tricky! :(

zanfilip avatar Apr 28 '20 11:04 zanfilip

the feature has been completed?

Silentdoer avatar Dec 21 '22 04:12 Silentdoer