I'm looking to instrument a recursive Makefile, and I want to see the complete calling tree that got me to where I'm at (which includes all parameters, etc). I don't care about the other processes on the system.
What I'm looking for is essentially pstree -ha
, where it only outputs the highlighted parts (plus the current process). Notice that pstree -ha <PID>
does not work, as it does not show the parent's parents for some reason (it does not go all the way up to init). I found another SO answer ps -f -g$BINOSPID
, but it shows siblings, which I don't want.
To spell out what I'm looking for: I want is this:
~> sh
sh-4.1$ bash
~> pstree -?? $$
init
`- sshd
`- bash
`- sh
`- bash
`- pstree -?? 1402
Also, as a side question, pstree -ha
automatically truncates the parameter list if it's to long. Is there a way to avoid that?