๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

โš™๏ธ Process Management October 11, 2026 8

Linux Command: pstree

Display processes as a tree showing parent-child relationships

Terminal โ€” Process Management
Command
$ pstree
Output
systemdโ”€โ”ฌโ”€sshdโ”€โ”€โ”€sshdโ”€โ”€โ”€bash โ”œโ”€nginxโ”€โ”€โ”€4*[nginx] โ””โ”€php-fpmโ”€โ”€โ”€8*[php-fpm]

pstree displays running processes as a tree, showing parent-child relationships. It provides a visual hierarchy of how processes are spawned and organized on the system. pstree merges identical branches by default, showing the count in brackets. This makes it easy to see how many worker processes a service has spawned. pstree is useful for understanding process relationships, debugging fork bombs, finding parent processes of orphaned children, and visualizing service architectures.

Syntax

pstree [OPTION]... [PID|USER]

Key Options

  • -p โ€” Show PIDs alongside process names
  • -u โ€” Show user transitions (uid changes)
  • -a โ€” Show command line arguments
  • -h โ€” Highlight current process and ancestors
  • -n โ€” Sort by PID instead of name
  • -l โ€” Long format (do not truncate)

Examples

View process tree

pstree

Output: systemdโ”€โ”ฌโ”€sshdโ”€โ”€โ”€sshdโ”€โ”€โ”€bash โ”œโ”€nginxโ”€โ”€โ”€4*[nginx] โ””โ”€php-fpmโ”€โ”€โ”€8*[php-fpm]

Tree with PIDs

pstree -p

Show specific user tree

pstree www-data

Pro Tips

  • pstree shows how many workers each service has: pstree | grep nginx reveals nginxโ”€โ”€โ”€4*[nginx] meaning 4 workers.
  • pstree merges identical children. 4*[nginx] means 4 identical nginx worker processes. Use -c to show them individually.
  • Use -l to prevent truncation of long command lines. Without it, wide trees may be cut off.

Learn more: Full pstree reference โ†’

Share this tip