Line Editor Commands

This chapter provides detailed information for the line editor set of commands for the S- K- and 7100-Series platforms. The command line editor determines which key sequences can be used in the CLI. Example: Ctrl+A will move the cursor to the beginning of the command line when in Emacs mode. The CLI supports both vi- and Emacs-like line editing commands. By default, the “default” line-editing mode is configured, with no special key sequences. Basic Line Editing Emacs & vi Commands lists some commonly used Emacs and vi commands. Use the set line-editor command (set line-editor) to change the line-editor mode. For information about configuring the line editor, refer to Using the CLI in the S-, K-, and 7100 Series Configuration Guide.

Click to expand in new window

Basic Line Editing Emacs & vi Commands

Key Sequence Emacs Command
Ctrl+A Move cursor to beginning of line.
Ctrl+B Move cursor back one character.
Ctrl+C Abort command.
Ctrl+D Delete a character.
Ctrl+E Move cursor to end of line.
Ctrl+F Move cursor forward one character.
Ctrl+H Delete character to left of cursor.
Ctrl+I or TAB Complete word.
Ctrl+K Delete all characters after cursor.
Ctrl+L or Ctrl+R Re-display line.
Ctrl+N Scroll to next command in command history (use the CLI history command to display the history).
Ctrl+P Scroll to previous command in command history.
Ctr1+Q Resume the CLI process.
Ctr1+S Pause the CLI process (for scrolling).
Ctrl+T Transpose characters.
Ctrl+U or Ctrl+X Delete all characters before cursor.
Ctrl+W Delete word to the left of cursor.
Ctrl+Y Restore the most recently deleted item.
h Move left one character.
l Move right one character.
k Get previous shell command in history.
j Get next shell command in history.
$ Go to end of line.
0 Go to beginning of line.
a Append.
A Append at end of line.
c SPACE Change character.
cl Change character.
cw Change word.
cc Change entire line.
c$ Change everything from cursor to end of line.
i Insert.
I Insert at beginning of line.
R Type over characters.
nrc Replace the following n characters with c.
nx Delete n characters starting at cursor.
nX Delete n characters to the left of the cursor.
d SPACE Delete character.
dl Delete character.
dw Delete word.
dd Delete entire line.
d$ Delete everything from cursor to end of line.
D Same as “d$”.
p Put last deletion after the cursor.
P Put last deletion before the cursor.
u Undo last command.
~ Toggle case, lower to upper or vice versa.