2016年12月5日 星期一

[Linux 常見問題] How to get child process from parent process


Source From Here
Question
Is it possible to get the child process id from parent process id in shell script?

How-To
You can leverage command pgrep. For example:
// List process tree
# ps auxf
...


// List process(s) with parent pid=3253
# pgrep -P 3253
3254
3545


// List process(s) with parent pid=3254
# pgrep -P 3254

// List process(s) with parent pid=3254
# pgrep -P 3545
3565
3712
3719
3736
 


沒有留言:

張貼留言

[ FP with Java ] Ch1 - What is functional programming

Preface   This chapter covers: ( Functional Programming in Java )  *  The benefits of functional programming *  Problems with side ef...