Here's what I want to do: I want to get a tree-formatted list of processes from ps (as when you do ps auxwwf
), but only of processes that are either owned by me, or are ancestors of processes owned by me. So if I own a bash process way down the tree, and it has ancestors owned by root, I want to see those root ancestors in addition to the ones I own. I do not want to see any process trees that do not contain any processes owned by me.
Is there any way to do this with ps's normal options, or do I need to write a script to parse the output?