How to get child process from parent process

child-process, linux, process, shell

Solution

Just use :

pgrep -P $your_process1_pid

Problem

Is it possible to get the child process id from parent process id in shell script? I have a file to execute using shell script, which leads to a new process process1 (parent process). This process1 has forked another process process2(child process). Using script, I'm able to get the pid of process1 using the command: ``` cat /path/of/file/to/be/executed ``` but i'm unable to fetch the pid of the child process.

Original source

Related problems