Advanced Usage¶
Basic¶
- help - show help info
- cls - clear out the current screen
- session - check details of the current session
- reset - reset all injected/enhanced classes
- version - print the version of the Arthas attaching to the current target process
- quit/exit - exit the current Arthas client without affecting other clients
- shutdown - terminate the Arthas server and all clients
JVM¶
class/classloader¶
- sc - check profiles of the classes loaded by JVM
- sm - check methods’ profile
- dump - dump out the byte code of the loaded classes to specified location
- redefine - load external
*.class
files and re-define the JVM-loaded classes - jad - de-compile the specified loaded classes
- classloader - check the inheritance structure, urls, class loading info of class cloader; using classloader to get the url of the resource e.g.
java/lang/String.class
pipe¶
pipe
is supported in Arthas, e.g. sm org.apache.log4j.Logger | grep <init>
Commands supported in pipe
:
- grep - filtering
- plaintext - remove the color
- wc - line counting
async in background¶
async will be a great help, when the incident
seldom occurs and you are watch
ing it.
- jobs - list all jobs
- kill - forcibly terminate the job
- fg - bring the paused job back to the front
- bg - put the paused job to the background
- tips - a) use
>
to redirect the output; b) use&
to put the job to the background; c) disconnecting the session will not influence the job (the default life is 1 day)
Others¶
- Web Console - using websocket to connect Arthas
- log the output
- batch
- how to use ognl