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

  • dashboard - real-time dashboard for the current system
  • thread - thread profile
  • jvm - JVM profile
  • sysprop - check or modify JVM system properties
  • New! getstatic :clap: - check the static properties of classes

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

options

  • options - check or set Arthas global options

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