OT: Windows equivalent of -ps

Sorry, but googling doesn’t seem to be leading me anywhere. I have a
number o Ruby examples from books that demonstrate things using the
Unix ps command for system status. Can someone please tell me what is
the equivalent call in the Windows environment ?

TIA
Stuart

On 9/8/06, Dark A. [email protected] wrote:

Sorry, but googling doesn’t seem to be leading me anywhere. I have a
number o Ruby examples from books that demonstrate things using the
Unix ps command for system status. Can someone please tell me what is
the equivalent call in the Windows environment ?

most probably pslist from sysinternals.com (NB: it’s worth looking at
other tools there as well)

On 9/8/06, Dark A. [email protected] wrote:

Sorry, but googling doesn’t seem to be leading me anywhere. I have a
number o Ruby examples from books that demonstrate things using the
Unix ps command for system status. Can someone please tell me what is
the equivalent call in the Windows environment ?

I always liked PsTools from sysinternals. I don’t know the exact
output of it (don’t have a windows pc at hand), but I think this is
what you are looking for:
http://www.sysinternals.com/Utilities/PsList.html

grtz,
wannes

Dark A. wrote:

Sorry, but googling doesn’t seem to be leading me anywhere. I have a
number o Ruby examples from books that demonstrate things using the
Unix ps command for system status. Can someone please tell me what is
the equivalent call in the Windows environment ?

There isn’t one. Have you considered installing Linux? Commands like
“ps”
are not platform-portable.

I’ve considered it but not feasible right now.
It’s not like not having ps is really hurting me.

Stuart

Dark A. wrote:

Sorry, but googling doesn’t seem to be leading me anywhere. I have a
number o Ruby examples from books that demonstrate things using the
Unix ps command for system status. Can someone please tell me what is
the equivalent call in the Windows environment ?

TIA
Stuart

See sys-proctable, available on the RAA, which serves as a
cross-platform solution to boot.

http://raa.ruby-lang.org/project/sys-proctable/

FYI, there are actually seven different ways to get process table
information on Windows, none of which are quite the same, and one of
which is undocumented. The sys-proctable version uses OLE + WMI on
Windows.

Regards,

Dan

Dark A. wrote:

Sorry, but googling doesn’t seem to be leading me anywhere. I have a
number o Ruby examples from books that demonstrate things using the
Unix ps command for system status. Can someone please tell me what is
the equivalent call in the Windows environment ?

TIA
Stuart

I’ve seen some of the responses to this post, and I’m really curious.
Which books use examples that require “ps”, and could you give some
examples of the use of “ps” in a Ruby script/program?

The reason I bring this up is that there are some times when doing “ps”
in a script is a very bad idea. Textbook examples that are OS-dependent
don’t impress me all that much, either, outside of the obligatory “how
to get up and running on Windows, Linux, MacOS and Solaris” chapters.

Well off the top of my head right now -
The first recipe in Ruby Cookbook - in the Rails chapter

Second -
AWDWR 2nd edition in the Web2.0 Chapter.

I am pretty sure I saw it somewhere else as well, but it’s not
surfacing right now.

Stuart

Dark A. wrote:

On 9/8/06, M. Edward (Ed) Borasky [email protected] wrote:

I’ve seen some of the responses to this post, and I’m really curious.
Which books use examples that require “ps”, and could you give some
examples of the use of “ps” in a Ruby script/program?

The reason I bring this up is that there are some times when doing “ps”
in a script is a very bad idea. Textbook examples that are OS-dependent
don’t impress me all that much, either, outside of the obligatory “how
to get up and running on Windows, Linux, MacOS and Solaris” chapters.

I don’t have my win pc at hand but you can try CygWin - its a pretty
comprehensive set of *nix tools and it may have a ps you can use.

Dark A. wrote:

Sorry, but googling doesn’t seem to be leading me anywhere. I have a
number o Ruby examples from books that demonstrate things using the
Unix ps command for system status. Can someone please tell me what is
the equivalent call in the Windows environment ?

If you are on WinXP (maybe also Win2k), try tasklist

I’ve been using it in a utility to monitor what apps I use.

tasklist /V

will report on these fields:

Image Name
PID
Session Name
Session#Mem Usage
Status
User Name
CPU Time
Window Title


James B.

“Take eloquence and wring its neck.”

  • Paul Verlaine

Dark A. wrote:

Well off the top of my head right now -
The first recipe in Ruby Cookbook - in the Rails chapter
I don’t have that one handy, but I’ll look it up

Second -
AWDWR 2nd edition in the Web2.0 Chapter.

Yeah … page 513 in my Beta PDF. Comments:

  1. Yeah, it’s “UNIX” specific, and it says so in the text.

  2. It’s demonstrating regular updates and the “backquote” operator. I
    assume the backquote works on Windows, so a better example might be some
    command that would work on Windows, Linux and MacOS. Just off the top of
    my head, the only thing I can recall is

    more logfile.txt

  3. Depending on the frequency and the number of processes, doing that
    “ps” can impact performance severely. “ps -a” lists all the processes
    running on the system. You don’t want to do this on a system with
    several thousand processes!

  4. If the application requirements specifically call for that
    functionality, there are usually better tools available. If not, it’s
    exposing some system internals to an end user that probably are either
    uninteresting or none of their (expletive deleted) business. “ps” is a
    command line system administration tool.

  5. There are worse versions of the “ps” command than “ps -a”. For
    example, “ps -vax” or “ps -uax” does a sort on all the processes! Take
    your system with thousands of processes and sort all those lines every
    two seconds? Not on my server, please!!