Find which service process created worker processes.
Display the process hierarchy with PIDs.
Which command is appropriate?
pstree -p displays processes in parent-child tree form and includes each PID.
Detailed explanation
ps -p treeIncorrect. ps -p expects a PID list; tree is not the process-tree option in this form.
Incorrect. ps -p expects a PID list; tree is not the process-tree option in this form.
pstree -pCorrect. pstree -p shows the process hierarchy and PIDs.
Correct. pstree -p shows the process hierarchy and PIDs.
pgrep --parent-allIncorrect. pgrep has no --parent-all option for this display.
Incorrect. pgrep has no --parent-all option for this display.
uptime -pIncorrect. uptime reports system uptime and load.
Incorrect. uptime reports system uptime and load.
Try it yourself
An example you can run in a temporary verification environment.
pstree -p $$ | headExpected result
現在shellを起点としたprocess treeKey points
- pstree
- PPID
- -p
Notes
- Environment: psmisc系pstree
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.