LinuxCommandLibrary

pstree

Display running processes as a tree

TLDR

Display a tree of all processes

$ pstree
copy
Display a tree with PIDs
$ pstree -p
copy
Display processes owned by a specific user
$ pstree username
copy
Display command line arguments
$ pstree -a
copy
Display children of a specific process
$ pstree 1234
copy
Display parents of a specific process
$ pstree -s 1234
copy
Highlight current process and ancestors
$ pstree -h
copy

SYNOPSIS

pstree [-a] [-c] [-h] [-p] [-s] [-u] [pid|user]

DESCRIPTION

pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. It visually compacts identical branches using square brackets and counts, and displays child threads under parent processes in curly braces.

PARAMETERS

-a, --arguments

Display command line arguments
-c, --compact-not
Disable compaction of identical subtrees
-C, --color
Color process names by attribute (e.g., age)
-g, --show-pgids
Show process group IDs
-h, --highlight-all
Highlight current process and its ancestors
-H pid, --highlight-pid
Highlight specified process and its ancestors
-l, --long
Display full-length lines without truncation
-n, --numeric-sort
Sort processes by PID instead of name
-N, --ns-sort
Show individual trees per namespace type
-p, --show-pids
Display process IDs
-s, --show-parents
Show parent processes of the specified process
-t, --thread-names
Show full thread names
-T, --hide-threads
Hide threads; show only processes
-u, --uid-changes
Show uid transitions
-Z, --security-context
Display SELinux security context
-A
Use ASCII line-drawing characters
-G
Use VT100 line-drawing characters
-U
Use UTF-8 line-drawing characters

CAVEATS

Some values shown (like command arguments) are read from /proc and may be modified by processes. Child threads are shown in curly braces {} and repeated identical branches are shown in square brackets [] with a count.

HISTORY

pstree is part of the psmisc package. It provides a hierarchical view of processes that complements the flat list provided by ps.

SEE ALSO

ps(1), top(1), htop(1), proc(5)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community