Walking a process tree

前端 未结 3 1904
独厮守ぢ
独厮守ぢ 2020-12-24 10:28

I have the following scenario.

The user would type the PID of a process, and the script should show the process and it\'s subprocesses, sub-subprocesses (and so on)

3条回答
  •  眼角桃花
    2020-12-24 10:38

    Your first step is to pipe ps through awk and grep. By using awk, you can isolate either the 'this process PID' field or the 'parent process PID' field.

    Or, have a stroll through the /proc file system.

提交回复
热议问题