Unix process hierachy tree display for specific processes (kind of mixed pgrep + pstree)
awk version of pgtree
pgtree is also able to send signal to found processes and all their children
Should work on any Unix that can execute :
# /usr/bin/pgrep
# /usr/bin/ps -e -o pid,ppid,user,comm,args
# pgtree -h
usage: pgtree [-ICya] [-c|-k|-K] [-p <pid1>,...|<pgrep args>]
-I : use -o uid instead of -o user for ps command
(if uid/user mapping is broken ps command can be stuck)
-c : display processes and children only
-k : kill -TERM processes and children
-K : kill -KILL processes and children
-y : do not ask for confirmation to kill
-C : no color (default colored output on tty)
-a : use ascii characters
by default display full process hierarchy (parents + children of selected processes)
-p <pids> : select processes pids to display hierarchy (default 1)
<pgrep args> : use pgrep to select processes (see pgrep -h)
found pids are prefixed with ▶
show all parents and children of processes matching bash
show processes matching bash
and their children
kill all sh
processes of user joknarf and their children