Use pstree to See Your Tree of Subshells
Execute the command
this with the ps command.
You should be able to trace out what's a child of what in the listings above, pretty easily.
Actually, in Linux, every process is the child of another process, except for the very first process, which is called init. Look:
csh
. The prompt changes! You are now running an older shell, csh, that has a different syntax. Try, for example, typing in a comment, like thisThis new shell is a subshell of the bash you were talking to a minute ago. Exit the subshell, and you'll see you're back in the parent shell. You can see# this is a comment
this with the ps command.
Each running program is a process, with an identifying number, or Process ID. If that process is a subprocess of some other program, then the ps command shown above also shows the Parent Process ID.
ps -o pid,ppid,args
csh
ps -o pid,ppid,args
exit
ps -o pid,ppid,args
You should be able to trace out what's a child of what in the listings above, pretty easily.
Actually, in Linux, every process is the child of another process, except for the very first process, which is called init. Look:
The numbers in parens are PIDs. Try invoking some subshells and watch how the process tree changes.
pstree -A -p | less
0 Comments:
Post a Comment
<< Home