The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 04-26-2002
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline
Registered User
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Good example.

When you use a command like grep or find, they kick off subprocesses (children processes) that actually do the work.

EXAMPLE #1
The parent ( the command that you typed.) "find . -name somefile -print " kicks off subprocesses that actually go out and search for the file that you specified. When they are done they report back to the find command.

EXAMPLE #2
Using grep if you are trying to do something like matching a pattern(s) in a file to print out the lines.

cat filename|grep patterna

This command will actually spawn 2 processes. The cat command, the parent, and the grep command, the child. When the child (grep) finishes it returns to the parent (cat) with the result.

Example #3
Do a ps -aef |grep sh" to find your telnet session. Find your login and do a ps -aef |grep on that PID. All of your commands are technically children of your telnet session as you will see.
__________________
My brain is your brain