JBoss CLI is built on top of Æsh (Another Extendable SHell). As such, the CLI inherits many features of Æsh, including its line editing mechanisms.

Æsh implements the majority of Readline functions for use by applications allowing users to edit commands as they’re entered, and provides additional features on top of these functions, such as advanced command creation and line parsing. In fact, the core Readline functionality is being moved out of the shell now in the spirit of modularity.

Readline supports Emacs and Vi editing modes. So does Æsh, and, transitively, the CLI. Emacs is their default mode. The basic default controls include:

Action Shortcut
Move back one character. or ⌃b
Move forward one character. or ⌃f
Previous line.
Next line.
Delete the character to the left of the cursor. delete
Delete the character underneath the cursor. ⌃d
Move to the start of the line. home or ⌃a
Move to the end of the line. end or ⌃e
Clear the screen. ⌃l
Kill from the cursor to the end of the line. ⌃k
Kill from the cursor to the previous whitespace. ⌃w
Yank killed text back into the buffer. ⌃y
Search backward in history. ⌃r
Search forward in history. ⌃s
Complete. tab

The list is not exhaustive and contains commonly used shortcuts working reliably on most platforms and shells. Emphasis is placed on OS X, hence the use of Mac notation. For PC, substitute for Ctrl and delete for backspace in the shortcuts.

The CLI does not have full support for vi, but it provides most of the line editing capabilities. The basic default controls in Vi mode are as follows:

Action Shortcut
Move back one character. (normal and insert modes) or h (normal mode)
Move forward one character. (normal and insert modes) or l (normal mode)
Previous line. k (normal mode)
Next line. n (normal mode)
Delete the character to the left of the cursor. X (normal mode), delete (insert mode)
Delete the character underneath the cursor. x (normal mode)
Substitute. s (normal mode)
Change. c (normal mode)
Replace character. r (normal mode)
Change case of a character. ~ (normal mode)
Undo. u (normal mode)
Move to the start of the line. 0 (normal mode)
Move to the end of the line. $ (normal mode)
Move forward a word. w (normal mode)
Move backward a word. b (normal mode)
Clear the screen. ⌃l (normal and insert modes)
Kill next word. dw (normal mode)
Kill from the cursor to the end of the line. d$ or D (normal mode)
Kill from the cursor to the end of the current word. db (normal mode)
Kill from the cursor to the previous whitespace. dB (normal mode)
Kill the current line. dd (normal mode)
Yank killed text back into the buffer after the cursor. p (normal mode)
Yank killed text back into the buffer before the cursor. P (normal mode)
Search backward in history. ⌃r (insert mode)
Search forward in history. ⌃s (insert mode)
Complete. tab (insert mode)

The list is not exhaustive – for more control options, see Vi reference manual.

To use Vi instead of the default Emacs mode, start the CLI with aesh.editmode=vi:

$ $JBOSS_HOME/bin/jboss-cli.sh -Daesh.editmode=vi

To make Vi the default mode, create ~/.inputrc file with the following contents:

set editing-mode vi

If the user-specific ~/.inputrc does not exist or cannot be read, /etc/inputrc is used as a system-wide default. A custom file can be set via the INPUTRC environment variable.

The file can also be used to specify custom key bindings, see the Readline documentation for more information.