I want to monitor only a process and its children processes on htop
. Filtering on the name of the parent process lists only the parent process, not its children. How do I show the children processes too?
How to display only a process and its descendant processes on htop
htop
Best Answer
Under Linux, you can do:
where
$PID
is the root process. This works as follows:pstree
, using the-p
option to list them with their PID.\((\d+)\)
), and outputs them separated with commas.htop -p
.For other OS like Mac OS, you may need to adapt the regular expression that retrieves the PIDs.
Note: It is unfortunately not possible to update the list with new children that are spawn later, because once
htop
has been executed, one cannot do anything else. This is a limitation ofhtop
(current version: 2.0.2).