Uploaded by joe1999us

Arthas Commands: Java Diagnostic Tool Reference

advertisement
All Commands | arthas
1 of 3
https://arthas.aliyun.com/en/doc/commands.html
HOME
ONLINE TUTORIALS
v4.0.5
DOCS
COMMANDS
DOWNLOAD
VERSIONS
DOCS
Introduction
All Commands
Quick Start
Install Arthas
Download
jvm - related
Fundamental Fields in
Expressions
• dashboard - dashboard for the system's real-time data
All Commands
• heapdump - dump java heap in hprof binary format, like jmap
• getstatic - examine class's static properties
auth
• jvm - show JVM information
base64
• logger - print the logger information, update the logger level
cat
• mbean - show Mbean information
classloader
• memory - show JVM memory information
cls
• ognl - execute ognl expression
dashboard
• perfcounter - show JVM Perf Counter information
dump
• sysenv — view system environment variables
echo
• sysprop - view/modify system properties
getstatic
• thread - show java thread information
grep
• vmoption - view/modify the vm diagnostic options.
heapdump
• vmtool - jvm tool, getInstances in jvm, forceGc
help
history
jad
jfr
jvm
class/classloader - related
• classloader - check the inheritance structure, urls, class loading info for the specified
class; using classloader to get the url of the resource e.g. java/lang/String.class
keymap
• dump - dump the loaded classes in byte code to the specified location
logger
• jad - decompile the specified loaded classes
mbean
• mc - Memory compiler, compiles .java files into .class files in memory
mc
• redefine - load external *.class files and re-define it into JVM
memory
• retransform - load external *.class files and retransform it into JVM
monitor
• sc - check the info for the classes loaded by JVM
ognl
• sm - check methods info for the loaded classes
options
perfcounter
profiler
monitor/watch/trace - related
pwd
quit
redefine
reset
retransform
sc
WARNING
Attention: commands here are taking advantage of byte-code-injection, which
means we are injecting some aspects
into the current classes for monitoring and
statistics purpose. Therefore, when using it for online troubleshooting in your
production environment, you'd better explicitly specify classes/methods/criteria,
session
9/2/25, 12:43 AM
All Commands | arthas
2 of 3
https://arthas.aliyun.com/en/doc/commands.html
HOME
and remember to remove the injected code by stop or reset .
ONLINE TUTORIALS
v4.0.5
DOCS
COMMANDS
DOWNLOAD
VERSIONS
• monitor - monitor method execution statistics
DOCS
Introduction
Quick Start
Install Arthas
• stack - display the stack trace for the specified class and method
• trace - trace the execution time of specified method invocation
• tt - time tunnel, record the arguments and returned value for the methods and replay
• watch - display the input/output parameter, return object, and thrown exception of
specified method invocation
Download
Fundamental Fields in
Expressions
All Commands
auth
base64
profiler/flame graph
• profiler - use async-profiler
to generate flame graph
• jfr - dynamic opening and closing of jfr recordings
cat
classloader
authentication
cls
dashboard
• auth - authentication
dump
echo
getstatic
grep
options
• options - check/set Arthas global optionss
heapdump
help
history
jad
jfr
jvm
pipe
Arthas provides pipe to process the result returned from commands further, e.g. sm
java.lang.String * | grep 'index' . Commands supported in pipe :
keymap
• grep- filter the result with the given keyword
logger
• plaintext - remove the ANSI color
mbean
• wc - count lines
mc
memory
monitor
ognl
options
async jobs
async can be handy when a problem is hardly to reproduce in the production environment,
e.g. one watch condition may happen only once in one single day.
perfcounter
profiler
• job control - use > to redirect result into the log file, use & to put the job to the
pwd
background. Job keeps running even if the session is disconnected (the session
quit
lifecycle is 1 day by default)
redefine
• jobs - list all jobs
reset
• kill - forcibly terminate the job
retransform
• fg - bring the suspend job to the foreground
sc
• bg - put the job to run in the background
session
9/2/25, 12:43 AM
All Commands | arthas
3 of 3
https://arthas.aliyun.com/en/doc/commands.html
HOME
ONLINE TUTORIALS
v4.0.5
DOCS
DOCS
COMMANDS
DOWNLOAD
VERSIONS
Basic Arthas Commands
Introduction
• base64 - Encode and decode using Base64 representation.
Quick Start
• cat - Concatenate and print files
Install Arthas
• cls - clear the screen
Download
Fundamental Fields in
Expressions
All Commands
auth
base64
cat
classloader
cls
dashboard
dump
echo
• echo - write arguments to the standard output
• grep - Pattern searcher
• help - display Arthas help
• history - view command history
• keymap - keymap for Arthas keyboard shortcut
• pwd - Return working directory name
• quit/exit - exit the current Arthas session, without effecting other sessions
• reset - reset all the enhanced classes. All enhanced classes will also be reset when
Arthas server is closed by stop
• session - display current session information
• stop - terminate the Arthas server, all Arthas sessions will be destroyed
• tee - Copies standard input to standard output, making a copy in zero or more files.
• version - print the version for the Arthas attached to the current Java process
getstatic
grep
heapdump
help
history
jad
jfr
Edit this page on GitHub
Last Updated: 8/25/2022, 3:33:49 AM
Contributors: hengyunabc, Fatpandac, longxu0509, Arteev Raina, Hearen, LHearen,
beiwei30
jvm
keymap
logger
mbean
mc
memory
monitor
ognl
options
perfcounter
profiler
pwd
quit
redefine
reset
retransform
sc
session
9/2/25, 12:43 AM
Download