← 返回命令列表

Linux command

jstack 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Print thread dump for Java process

jstack [pid]

Force thread dump on hung process

jstack -F [pid]

Print concurrent locks info

jstack -l [pid]

Print mixed mode stack traces

jstack -m [pid]

说明

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.

参数

-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.

FAQ

What is the jstack command used for?

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.

How do I run a basic jstack example?

Run `jstack [pid]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -F do in jstack?

Force thread dump when process is hung.