$linuxjunkies
>

pstree(1)

Display a tree of processes showing parent-child relationships.

UbuntuDebianFedoraArch

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

FlagWhat it does
-pShow process IDs (PIDs) next to process names
-uShow user name changes; highlight where process owner differs from parent
-gShow process group IDs
-aShow command-line arguments for each process
-cDisable collapsing of identical subtrees
-hHighlight the specified PID and its ancestors
-H PIDSame as -h, takes PID as argument
-lUse long format with less tree-drawing and more detail
-nSort by PID instead of by name
-SShow process start times

Examples

Display the entire process tree starting from init/systemd

pstree

Show process tree with PIDs displayed next to each process name

pstree -p

Show process tree starting from PID 1234 and all its children

pstree -p 1234

Show process tree for processes owned by the specified user

pstree -u username

Display tree with PIDs and highlight PID 5678 and its ancestors

pstree -p -H 5678

Show process tree starting from the bash process

pstree -p bash

Display full tree with PIDs and command arguments, paginated

pstree -p -a | less

Show sshd and child processes with PIDs and user changes highlighted

pstree -u -p sshd

Related commands