优雅地获取子进程列表


13

我想获取其父代为$ pid的所有进程的列表。这是我想出的最简单的方法:

pstree -p $pid | tr "\n" " " |sed "s/[^0-9]/ /g" |sed "s/\s\s*/ /g"

是否有任何命令或更简单的方法来获取子进程列表?

谢谢!

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.