Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add ability to filter out processes from output via regexp and/or parent status #463

Open
vvuk opened this issue Apr 14, 2023 · 2 comments

Comments

@vvuk
Copy link

vvuk commented Apr 14, 2023

Many times I want to basically do ps -ef | grep foo and get a specific foo's pid. However, sometimes foo actually spawns a million child processes, and I really only care about some specific ones where "some" might be the primary parent process, but might also be a subset of child processes. So, two features:

  1. when run with some keywords to search, only show processes whose parent does not match those keywords. For example:
% procs -t Edge
        PID   User     │ TTY CPU MEM CPU Time │ Command                                                                                                 >
                       │     [%] [%]          │                                                                                                         >
 ├┬──── 11101 vladimir │     0.0 1.1 00:00:07 │ /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge                                          >
 │├──── 11109 vladimir │     0.0 0.3 00:00:07 │ /Applications/Microsoft Edge.app/Contents/Frameworks/Microsoft Edge Framework.framework/Versions/112.0.1>
 │├──── 11110 vladimir │     0.0 0.3 00:00:02 │ /Applications/Microsoft Edge.app/Contents/Frameworks/Microsoft Edge Framework.framework/Versions/112.0.1>
 │├──── 11112 vladimir │     0.0 0.1 00:00:00 │ /Applications/Microsoft Edge.app/Contents/Frameworks/Microsoft Edge Framework.framework/Versions/112.0.1>
 │├──── 11123 vladimir │     0.0 0.1 00:00:00 │ /Applications/Microsoft Edge.app/Contents/Frameworks/Microsoft Edge Framework.framework/Versions/112.0.1>
 │├──── 11127 vladimir │     0.0 0.2 00:00:00 │ /Applications/Microsoft Edge.app/Contents/Frameworks/Microsoft Edge Framework.framework/Versions/112.0.1>
 ...
 └───── 11103 vladimir │     0.0 0.0 00:00:00 │ /Applications/Microsoft Edge.app/Contents/Frameworks/Microsoft Edge Framework.framework/Versions/112.0.1722.34/Helpers/msedge_crashpad_handler --monitor-self-annotation=ptype=crashpad-handler --database=/Users/vladimir/Library/Application Support/Microsoft Edge/Crashpad --annotation=IsOfficialBuild=1 --annotation=channel= --annotation=exe=Microsoft Edge --annotation=plat=OS X --annotation=prod=Microsoft Edge_Mac --annotation=ver=112.0.1722.34 --handshake-fd=5

with the new option, should only show process 11101 and 11103 (because 11103 is not a child of 11101, unlike all the other framework processes).

  1. a --exclude that takes a regexp argument, that filters out processes whose command lines match the regex. In the above example, adding --filter-out handshake-fd would also filter out process 11103, because it contains "handshake-fd".

While we're at it, could make the default keyword search a regex as well!

@vvuk
Copy link
Author

vvuk commented Apr 15, 2023

Forgot to mention -- for some reason setting display.show_children_in_tree to false doesn't hide the Edge children above.

@luckman212
Copy link

@vvuk Nice feature request. I came here looking for help on simple fixed string exclusion, which I think is possible in the current version 0.14. For example, to list bash but not -bash. Do you know if this is possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants