[sf-lug] ps and grep
tom at greenleaftech.net
Thu Mar 6 17:48:50 PST 2008
On Thu, 2008-03-06 at 17:47 -0800, jim stockford wrote:
> at the point you type the ps command and hit
> enter, you've kicked off a new process, something
> $ ps aux | grep doit
> the pipe character is also a command delimiter:
> you've kicked off two processes, the first one loaded
> is the grep process and the second one loaded is
> the ps process. after all, nothing runs unless it's a
> process, and for ps to get the output of grep then
> grep has to be loaded first so's to be in place, right?
Do you mean that for grep to process ps's output, grep has to be loaded
first? If so, this all makes sense, and I think I have it.
> but it's only after those two processes are loaded
> that the ps command starts its work, which means
> it's dumping all processes including the grep
> process and the ps process itself. you've asked
> grep to filter out everything but any line that has
> doit on it, so if the doit process is running, you get
> that line, and you also get the line for which doit is
> an argument: the grep process.
> make sense?
> On Mar 6, 2008, at 5:17 PM, Tom Haddon 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
> > _______________________________________________
> > sf-lug mailing list
> > sf-lug at linuxmafia.com
> > http://linuxmafia.com/mailman/listinfo/sf-lug
More information about the sf-lug