LinuxCommandLibrary

jstack

prints Java thread stack traces for a given Java process

TLDR

Print thread dump for Java process

$ jstack [pid]
copy
Force thread dump on hung process
$ jstack -F [pid]
copy
Print concurrent locks info
$ jstack -l [pid]
copy
Print mixed mode stack traces
$ jstack -m [pid]
copy

SYNOPSIS

jstack [options] pid

DESCRIPTION

jstack prints Java thread stack traces for a given Java process. It is useful for diagnosing deadlocks, performance issues, and analyzing thread states. Part of the JDK diagnostic tools suite.

PARAMETERS

-F

Force thread dump when process is hung.
-l
Long listing with lock information.
-m
Print mixed mode (Java and native) stack traces.
-h, --help
Display help message.

CAVEATS

The target process must be running with the same user or you need root privileges. The -F option should only be used when the process is not responding.

SEE ALSO

jps(1), jmap(1), jcmd(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community