Why not wink  https://github.com/robzr/OpenWRT-utils/ … cro-pstree

#!/bin/sh
P(){
[ $1 = 0 ]&&return
echo -$1 `cat /*/$1/c*e|tr \\\0 \ `
[ $1 = $$ ]&&return
L=0
for k in `egrep ^PPid:\    $1$ /*/[0-9]*/s*s|cut -f3 -d/`
do
P $L|sed -n '/[0-9]/s/^/ |/p'
L=$k
done
P $L|sed -n '/[0-9]/s/^/ L/p'
}
P 1|sed 's/L /  /g'

If you cut-n-paste the above, make sure there is a tab in the egrep string, not spaces.  The "full size" 381 byte version has nicer formatting, is easier to read, takes an optional PID argument and behaves a bit better than the shrunken version.  pstree is useful on OpenWRT since busybox ps does not show PPID.

Rob

(Last edited by robzr on 26 Jan 2016, 00:22)