Exploring Parent and Child Shell Relationships
The default interactive shell started when a user logs into a virtual console terminal or starts a terminal emulator in the GUI is a parent shell. As you have read so far in this book, a parent shell process provides a CLI prompt and waits for commands to be entered.
When the /bin/bash
command or the equivalent bash
command is entered at the CLI prompt, a new shell program is created. This is a child shell. A child shell also has a CLI prompt and waits for commands to be entered.
Because you do not see any relevant messages when you type bash and spawn a child shell, another command can help bring clarity. The ps
command was covered in Chapter 4. Using this with the -f
option before and after entering a child shell is useful:
$ ps -f
UID PID PPID C STIME TTY TIME CMD
501 1841 1840 0 11:50 pts/0 00:00:00 -bash
501 2429 1841 4 13:44 pts/0 00:00:00 ps -f
$
$ bash
$
$ ps -f
UID PID PPID C STIME...