Content of this article is based on arthas 3.5.1 track of version, introduce basic command CLS, session, version, the use of the history and implementation.

A. CLS command

Clear the current screen area.

Files at com.taobao.arthas.core.com mand. Basic1000. ClsCommand. Java, according to the picture above. In non-terminal mode, Command ‘CLS’ is only support TTY session.

Otherwise renderutil.cls () will be executed. The effect of this method actually returns \u001b[H\u001b[2J for Ansi Escape Codes indicating clear screen.

2. The session command

View information about the current session, including the current BOUND PID and the session ID. \

The file is located incom.taobao.arthas.core.command.basic1000.SessionCommand.java

If a tunnel server is configured, the proxy ID, URL of the tunnel server, and connection status are displayed.

If statURL is used for statistics, the statURL address is displayed.

3. Version command

Prints the Arthas version number loaded by the current target Java process. Files at com.taobao.arthas.core.com mand. Basic1000. VersionCommand. Java \

performArthasBanner.version()Gets the version number.

/com/taobao/arthas/core/res/versionPath to obtain the version number, the file will be executedas.package.shGenerated when the script is packaged.

If no, passArthasBanner.class.getPackage().getImplementationVersion()Get the version number from the packaged POM.xml file.

4. History command

The history command is displayed. The history command is also displayed.

The parameter name Parameters of the abbreviations Parameters that mandatory The sample
–clear -c Clearing History optional history -c
n The n commands executed recently are displayed optional history 3

example

Clear history -c To view the history 3 command executed recently

Files at com.taobao.arthas.core.com mand. Basic1000. HistoryCommand. Java implementation can see HistoryManager HistoryManagerImpl interface implementation class. Terminal mode is implemented in the TermImpl class.

System.getProperty("user.home") + File.separator + ".arthas" + File.separator + "history"
Copy the code

The history is stored in the /Users/ Users/.arthas/history file.

The history command retrieves the history commands executed from the history file, so you can see all the history commands on this server.