Shell Processes   «Prev  Next»
Lesson 5 Parent and child processes
Objective Relationship between Parent and Child Processes

Relationship between Parent and Child Processes

When you run a program in your shell, a process is created. This new process is called a child process of the shell. The originating process (the shell from which you ran the command) is called the parent process of the child. When you run a new shell, you are creating a child process under the originating shell. Examine the SlideShow below to see an example of new processes being created as shells are run from the command line.


  1. Running the ps command shows that you are running 1 process
  2. The diagram reflects the processes you have running
  3. This is a child process under the Bourne shell in which it was created
  4. The diagram is updated to reflect the new process. It is a child of Bourne
  5. The C shell is now in the foreground and both the Korn and Bourne shells are in the background
  6. Diagram is updated to reflect new process
  7. Quit the C shell using the exit command

The ps –f command

The command ps –f lists all of the processes you are currently running. The–f displays a full list of information. This information includes the PID of the parent process, which is referred to as the PPID in the ps command output. Look at the sample ps –f command below. It reflects the processes created in the SlideShow above. Connecting lines are included in the command below to point out the relationship between the PID and PPID numbers. These lines are not normally part of the output, they are just used here for clarification.
parentchild_010gr

In the listing above, the /bin/ksh process (PID 3723) was started from the /bin/sh process (PID 3707), so 3707 is listed as the PPID of 3723. The /bin/csh process (PID 3725) was started from the /bin/ksh process (PID 3723), so 3725 is listed as the PPID of 3725.
The next lesson examines three different techniques for running a shell script.

Unix Shell Programming