Using Control Characters
All editing commands are control characters which are entered by holding the Ctrl or Esc key while typing another key, as listed in the following table. All editing commands operate from any place on the line, not just at the beginning of the line.
Command Line Editing Control Characters
Control Character | Description |
---|---|
Ctrl-A | Moves the cursor to the beginning of the line. |
Ctrl-B | Moves the cursor to the left (back) one column. |
Esc-B | Moves the cursor back one word. |
Ctrl-D | Deletes the character to the right of the cursor. |
Ctrl-E | Moves the cursor to the end of the line. |
Ctrl-F | Moves the cursor right (forward) one column. |
Esc-F | Moves the cursor forward one word. |
Ctrl-H | Deletes the character to the left of the cursor. |
Ctrl-I | Jumps to the next tab stop. |
Ctrl-J | Returns the current line. |
Ctrl-K | Kills from the cursor to the end of the line (see Ctrl-Y). |
Ctrl-L | Redisplays the current line. |
Ctrl-M | Returns the current line. |
Ctrl-N | Fetches the next line from the history list. |
Ctrl-O | Toggles the overwrite/insert mode, initially in insert mode. |
Ctrl-P | Fetches the previous line from the history list. |
Ctrl-R | Begins a reverse incremental search through the history list. Each printing character typed adds to the search substring (which is empty initially). MQL finds and displays the first matching location. Typing Ctrl-R again marks the current starting location and begins a new search for the current substring. |
Type Ctrl-H | Or press the Del key to delete the last character from the search string. MQL restarts the search from the last starting location.Repeated Ctrl-H or Del characters, therefore, unwind the search to the match nearest to the point where you last typed Ctrl-R or Ctrl-S (described below).Type Esc or any other editing character to accept the current match and terminate the search. |
Type Ctrl-H | Or press the Del key until the search string is empty to reset the start of the search to the beginning of the history list. Type Esc or any other editing character to accept the current match and terminate the search. |
Ctrl-S | Begins a forward incremental search through the history list. The behavior is like Ctrl-R but in the opposite direction through the history list. |
Ctrl-T | Transposes the current and previous character. |
Ctrl-U | Kills the entire line (see Ctrl-Y). |
Ctrl-Y | Yanks the previously killed text back at the current location.Backspace Deletes the character left of the cursor. |
Del | Deletes the character right of the cursor. |
Return | Returns the current line. |
Tab | Jumps to the next tab stop. |