Command pstree PID
can show all subprocess information of the process specified by PID
. However, I also want to know all parent process information of the process PID
, how can I get it?
An example:
init |- parent_process | `- current_process | |- subprocess_1 | `- subprocess_2 `- other_process
What I want is when I run pstree current_process_pid
, I want to get below output:
init `- parent_process `- current_process |- subprocess_1 `- subprocess_2
When I run pstree subprocess_1_pid
, it will output:
init `- parent_process `- current_process `- subprocess_1