[sf-lug] ps and grep

Alex Kleider a_kleider at yahoo.com
Thu Mar 6 17:44:57 PST 2008

--- Tom Haddon <tom at greenleaftech.net> wrote:

> Bit of an elementary question, this, but can someone remind me why: 
> ps fuwxx | grep <something>
> returns "grep <something>" in the list if finds? Intuition would
> suggest
> that the ps is happening first, and so the grep command wouldn't show
> in
> the list. One of those things that was explained to me once, but
> seems
> to have slipped through my sieve-like memory...
> Cheers, Tom

This should NOT be construed as an answer:
rather as a question: is my understanding correct?

$ ps ....  | grep <something>

although calling two utilities, is in fact one command
which tells the shell to set up two processes with the latter
to use input that is output from the former.
If the shell began the ps utility first then where would it's output
Both must be running; in fact, if one must start first, it would seem
more logical to me to start grep 1st and it'll just wait for input.

I'm looking forward to the erudite answers which surely must follow..

a_kleider at yahoo.com

Never miss a thing.  Make Yahoo your home page. 

More information about the sf-lug mailing list