pstree

Introduction

Pstree is a Unix tool that shows the running processes as a tree. It is inspirated in Linux psmisc package and ported to various Unix systems *BSD, Solaris, AIX, …

Example - NetBSD 6.1.2:

$ pstree
system---init-+-cron
              |-4*[getty]
              |-inetd
              |-master-+-pickup
              |        `-qmgr
              |-ntpd
              |-powerd
              |-screen-4.0.3---sh
              |-sshd---sshd---sh---pstree
              `-syslogd

Example - OpenBSD 5.3:

$ pstree                           
swapper-+-acpi0
        |-aiodoned
        |-cleaner
        |-crypto
        |-idle0
        |-init-+-cron
        |      |-5*[getty]
        |      |-inetd
        |      |-ntpd---ntpd---ntpd
        |      |-pflogd---pflogd
        |      |-screen---ksh
        |      |-sendmail
        |      |-sndiod
        |      |-sshd---sshd---ksh---pstree
        |      `-syslogd---syslogd
        |-pagedaemon
        |-pfpurge
        |-reaper
        |-syswq
        |-update
        |-usbatsk
        |-usbtask
        `-viomb

Example - FreeBSD 9.2:

$ pstree
kernel-+-audit
       |-bufdaemon
       |-geom-+-{g_down}
       |      |-{g_event}
       |      `-{g_up}
       |-idle
       |-init-+-adjkerntz
       |      |-cron
       |      |-devd
       |      |-8*[getty]
       |      |-2*[sendmail]
       |      |-sshd---sshd---csh---pstree
       |      `-syslogd
       |-intr-+-{irq11: ed0 uhci0}
       |      |-{irq12: psm0}
       |      |-{irq14: ata0}
       |      |-{irq15: ata1}
       |      |-{irq1: atkbd0}
       |      |-{swi0: uart}
       |      |-{swi1: netisr 0}
       |      |-{swi2: cambio}
       |      |-{swi3: vm}
       |      |-{swi4: clock}
       |      |-{swi5: fast taskq}
       |      |-{swi6: Giant task}
       |      `-{swi6: task queue}
       |-pagedaemon
       |-pagezero
       |-sctp_iterator
       |-softdepflush
       |-syncer
       |-usb---4*[{usbus0}]
       |-vmdaemon
       |-vnlru
       |-xpt_thrd
       |-yarrow
       |-{acpi_task_0}
       |-{acpi_task_1}
       |-{acpi_task_2}
       |-{ffs_trim taskq}
       |-{firmware taskq}
       |-{kqueue taskq}
       |-{mca taskq}
       |-{swapper}
       |-{thread taskq}
       `-{virtio_balloon}