TIL: pstree command

pstree is a way to view the process family tree in a unix/linux system.

$ pstree
        │           └─10*[{node}]
        │         └─dbus-daemon
        ├─tmux: server───2*[bash]

There’s some notation in how the tree is displayed:

  • multiple instances of the same process are collapsed as n*[process_name]. See 2*[agetty] above.
  • curly braces are used to show threads.

You can use pstree -a -l to view the cli arguments with which the processes were launched as well. Hide threads information with -T — useful if you wanna see how the processes were launched. Although pstree is not available on Mac OS X and you might probably wanna use the more portable ps | more for that.