pstree(1)
Display a tree of processes showing parent-child relationships.
Synopsis
pstree [OPTION]... [PID|USER]Description
pstree shows running processes in a tree format, making it easy to see process hierarchies and identify parent processes. By default it starts from the root process (init or systemd) but can show subtrees for any PID or user.
Duplicate subtrees are collapsed and shown with an asterisk to reduce clutter. This is useful for understanding process relationships, debugging startup sequences, and tracking resource usage across related processes.
Common options
| Flag | What it does |
|---|---|
-p | Show process IDs (PIDs) next to process names |
-u | Show user name changes; highlight where process owner differs from parent |
-g | Show process group IDs |
-a | Show command-line arguments for each process |
-c | Disable collapsing of identical subtrees |
-h | Highlight the specified PID and its ancestors |
-H PID | Same as -h, takes PID as argument |
-l | Use long format with less tree-drawing and more detail |
-n | Sort by PID instead of by name |
-S | Show process start times |
Examples
Display the entire process tree starting from init/systemd
pstreeShow process tree with PIDs displayed next to each process name
pstree -pShow process tree starting from PID 1234 and all its children
pstree -p 1234Show process tree for processes owned by the specified user
pstree -u usernameDisplay tree with PIDs and highlight PID 5678 and its ancestors
pstree -p -H 5678Show process tree starting from the bash process
pstree -p bashDisplay full tree with PIDs and command arguments, paginated
pstree -p -a | lessShow sshd and child processes with PIDs and user changes highlighted
pstree -u -p sshd