How to get child process from parent process

前端 未结 9 785
清歌不尽
清歌不尽 2020-11-30 23:05

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

9条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 23:15

    You can get the pids of all child processes of a given parent process by reading the /proc//task//children entry.

    This file contain the pids of first level child processes.

    For more information head over to https://lwn.net/Articles/475688/

提交回复
热议问题