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
 


沒有留言:

張貼留言

[ Python 文章收集 ] cmd – Create line-oriented command processors

Source From  Here   Preface   The  cmd  module contains one public class,  Cmd , designed to be used as a base class for command processors ...