Having some processes that create lots of parallel sub-processes it would be nice if one could select the top process (or multiple) and filter to only display those selected processes and any of their children.
You can use -/+ key to collapse/expand a tree. Is this what you need?
Collapsing/expanding a certain subtree is quite helpful with large process structures like Chromium (to hide them). The feature request quite goes into the opposite direction and aims to reduce "noise" in the process view.
Suppose you have a machine for which you want to monitor several batch jobs (from different users). Those jobs (e.g. compiling large software projects) spawn several processes, but stay all within their respective process tree. What I'd like to do is select one or multiple of the processes (the main make process) and one all are selected go ahead and filter to display only processes previously selected or a child (or (grand)*child) of a selected process.
PID COMMAND
1 /bin/init
2 +- /bin/login user1
3 | \- /bin/bash
+ 4 | \- /usr/bin/make -j
5 | |- buildtask1
6 | |- buildtask2
7 | |- buildtask3
8 | \- buildtask4
9 \- /bin/login user2
10 \- /bin/bash
+ 11 \- /usr/bin/make -j
12 |- buildtask1
13 |- buildtask2
14 |- buildtask3
15 \- buildtask4
Becomes (+ in previous means selected):
PID COMMAND
4 …- /usr/bin/make -j
5 |- buildtask1
6 |- buildtask2
7 |- buildtask3
8 \- buildtask4
11 …- /usr/bin/make -j
12 |- buildtask1
13 |- buildtask2
14 |- buildtask3
15 \- buildtask4
I hope this drawing helps to illustrate the usecase.
This would be super useful.
While you can use +/- to collapse PID trees that are not of interest, on a busy server one needs to collapse dozens of PID trees before you get to the one of interest.
Rather than a -p that shows only the specific PID, a -P that shows the specified PIS and all its child processes would be fantastic.
eg:
[ec2-user@xxxoooo 2019-04-04_18-23-51]$ ps ax | wc -l
1253
About 200 of these are top level.
Even better would be to have a "Show only PID trees where the process name matches a regex against the command with parameters", eg:
htop -P bash*command
To show all shell invocations of "command" and their PID subtrees
This is one of the features I always wanted in htop.
I would also like this feature.
Most helpful comment
This would be super useful.
While you can use +/- to collapse PID trees that are not of interest, on a busy server one needs to collapse dozens of PID trees before you get to the one of interest.
Rather than a -p that shows only the specific PID, a -P that shows the specified PIS and all its child processes would be fantastic.
eg:
[ec2-user@xxxoooo 2019-04-04_18-23-51]$ ps ax | wc -l
1253
About 200 of these are top level.
Even better would be to have a "Show only PID trees where the process name matches a regex against the command with parameters", eg:
htop -P bash*command
To show all shell invocations of "command" and their PID subtrees