Display only a process subtree

Solution 1:

You can use pstree to do this and get a nicely formatted output too

pstree -p 22221
mysqld_safe(22221)─┬─logger(22334)
                   └─mysqld(22332)─┬─{mysqld}(22335)
                                   ├─{mysqld}(22336)
                                   ├─{mysqld}(22337)
                                   ├─{mysqld}(22338)
                                   ├─{mysqld}(22340)
                                   ├─{mysqld}(22341)
                                   ├─{mysqld}(22342)
                                   ├─{mysqld}(22343)
                                   ├─{mysqld}(22346)
                                   └─{mysqld}(22394)

Solution 2:

$ ps -p 1426 --ppid 1426 --forest

or:

$ ps -eo pid,ppid,tty,stat,time,command --forest | awk '$1 == 1426 || $2 == 1426'

to display the details command.