ptree - display a process tree
ptree [-an] [pids | logins]
Ptree outputs a graph of the given processes with children indented 2
spaces to the right of their immediate parent. By default the graph
includes only children of init (process 1).
The output graphs include each of the pids presented, any processes
owned by each login requested, and any processes which link those back
to init, unless -n is given. Each process is only output once.
A pids list of dash (-) traces to the ptree process itself.
By default the process tree doesn't include system processes
that are peers of init(8). This option removes that injunction.
Print only a brief help message.
This option suppresses the trace for each target process's
ancestors back towards init(8). The output will only contain
Show only the standerd version banner.
Display the process tree from this shell up to, but not includ-
ptree -a $$
Same as above, but include (any peer of) init as well.
Show the whole of the process table, other than kernel threads.
Show all the processes running for the login "ksb".
ptree -n 'pgrep cron'
Graph the the descendants of the running cron(8) daemon.
pgrep cron | xapply -f 'ptree -n' -
A better version of the cron spell, as the lack of a running
cron doesn't output a graph for the whole system.
pgrep cron | xapply -f -N 'echo cron is dead%0' 'ptree -n' -
Even better, report that cron is dead when that's the case.
Pete Fritchman and Kevin Braunsdorf
NonPlayer character Guild
ptree at ksb.npcguild.org.nospam
sh(1), ps(1), pgrep(1), killall(1), xapply(1L), cron(8), pkill(1)