Keyboard shortcuts for editing CLI commands

The command at the current command prompt is the active command. Using keyboard shortcuts enables you to edit the active command quickly. These keyboard shortcuts are similar to those of the UNIX tcsh shell and the Emacs editor.

The following table lists the keyboard shortcuts for editing CLI commands. "Ctrl-" indicates that you press and hold the Ctrl key while typing the character specified after it. "Esc-" indicates that you press and release the Esc key and then type the character specified after it.

If you want to… Use the following keyboard shortcut…
Move the cursor back by one character Ctrl-B
Back arrow
Move the cursor forward by one character Ctrl-F
Forward arrow
Move the cursor back by one word Esc-B
Move the cursor forward by one word Esc-F
Move the cursor to the beginning of the line Ctrl-A
Move the cursor to the end of the line Ctrl-E
Remove the content of the command line from the beginning of the line to the cursor, and save it in the cut buffer

The cut buffer acts like temporary memory, similar to what is called a clipboard in some programs.

Ctrl-U
Remove the content of the command line from the cursor to the end of the line, and save it in the cut buffer Ctrl-K
Remove the content of the command line from the cursor to the end of the following word, and save it in the cut buffer Esc-D
Remove the word before the cursor, and save it in the cut buffer Ctrl-W
Yank the content of the cut buffer, and push it into the command line at the cursor Ctrl-Y
Delete the character before the cursor Ctrl-H
Backspace
Delete the character where the cursor is Ctrl-D
Clear the line Ctrl-C
Clear the screen Ctrl-L
Replace the current content of the command line with the previous entry on the history list

With each repetition of the keyboard shortcut, the history cursor moves to the previous entry.

Ctrl-P
Esc-P
Up arrow
Replace the current content of the command line with the next entry on the history list

With each repetition of the keyboard shortcut, the history cursor moves to the next entry.

Ctrl-N
Esc-N
Down arrow
Expand a partially entered command or list valid input from the current editing position Tab
Ctrl-I
Display context-sensitive help ?
Escape the special mapping for the question mark ("?") character

For instance, to enter a question mark into a command's argument, press Esc and then the "?" character.

Esc-?
Start TTY output Ctrl-Q
Stop TTY output Ctrl-S