Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 645  / 1 Year ago, wed, february 15, 2023, 3:02:46

When you open a new terminal, it becomes the parent process of all processes forked within it. But where does the bash shell, for example, fall into this process chain? Is its parent the terminal? Are all processes forked within the shell children of the shell? If so, then when I change shells, why do the processes still remain running? In short, where does the shell fall in the process hierarchy?


More From » bash

 Answers
7

Indeed the parent of the bash process is the terminal. You can see the process hierarchy using the ps -aef command:



$ ps -aef
UID PID PPID C STIME TTY TIME CMD
[...]
sylvain 3510 1862 2 22:02 ? 00:00:01 gnome-terminal
[...]
sylvain 3520 3510 0 22:02 pts/1 00:00:00 bash
sylvain 3587 3520 0 22:03 pts/1 00:00:00 sh



  • PID: Process ID

  • PPID: Parent Process ID



In this example I started a sh process (3587) from the bash shell (3520)


[#26529] Thursday, February 16, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
overine

Total Points: 20
Total Questions: 109
Total Answers: 98

Location: Aruba
Member since Fri, Jun 24, 2022
2 Years ago
overine questions
Tue, Jul 12, 22, 00:27, 2 Years ago
Wed, Jan 11, 23, 02:15, 1 Year ago
Tue, Aug 10, 21, 01:39, 3 Years ago
;