程式扎記: [Linux 常見問題] How to get child process from parent process

標籤

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
 


沒有留言:

張貼留言

網誌存檔

關於我自己

我的相片
Where there is a will, there is a way!