Table of Contents
# All Commands
# jvm - related
- dashboard - dashboard for the system's real-time data
- getstatic - examine class's static properties
- heapdump - dump java heap in hprof binary format, like
jmap
- jvm - show JVM information
- logger - print the logger information, update the logger level
- mbean - show Mbean information
- ognl - execute ognl expression
- perfcounter - show JVM Perf Counter information
- sysenv — view system environment variables
- sysprop - view/modify system properties
- thread - show java thread information
- vmoption - view/modify the vm diagnostic options.
- vmtool - jvm tool, getInstances in jvm, forceGc
# 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
- dump - dump the loaded classes in byte code to the specified location
- jad - decompile the specified loaded classes
- mc - Memory compiler, compiles
.java
files into.class
files in memory - redefine - load external
*.class
files and re-define it into JVM - retransform - load external
*.class
files and retransform it into JVM - sc - check the info for the classes loaded by JVM
- sm - check methods info for the loaded classes
# monitor/watch/trace - related
WARNING
Attention: commands here are taking advantage of byte-code-injection, which means we are injecting some aspectsopen in new window 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, and remember to remove the injected code by stop
or reset
.
- monitor - monitor method execution statistics
- 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
# authentication
- auth - authentication
# options
- options - check/set Arthas global options
# profiler/flame graph
- profiler - use async-profileropen in new window to generate flame graph
# pipe
Arthas provides pipe
to process the result returned from commands further, e.g. sm java.lang.String * | grep 'index'
. Commands supported in pipe
:
- grep - filter the result with the given keyword
- plaintext - remove the ANSI color
- wc - count lines
# 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.
- job control - use
>
to redirect result into the log file, use&
to put the job to the background. Job keeps running even if the session is disconnected (the session lifecycle is 1 day by default) - jobs - list all jobs
- kill - forcibly terminate the job
- fg - bring the suspend job to the foreground
- bg - put the job to run in the background
# Basic Arthas Commands
- base64 - Encode and decode using Base64 representation.
- cat - Concatenate and print files
- cls - clear the screen
- 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