Understanding the Command-Line Interface
This example shows how to recall a command and reenter it:
switch(config)# show cli history
0
11:04:07
1
11:04:28
2
11:04:39
3
11:05:13
4
11:05:19
5
11:05:25
switch(config)# !1
switch(config)# show interface ethernet 2/24
You can also use the Ctrl-P and Ctrl-N keystroke shortcuts to recall commands.
Configuring the CLI Edit Mode
You can recall commands from the CLI history using the Ctrl-P and Ctrl-N keystroke shortcuts and edit
them before reissuing them. The default edit mode is emacs. You can change the edit mode to vi.
SUMMARY STEPS
1. [no] terminal edit-mode vi [persist]
DETAILED STEPS
Command or Action
Step 1
[no] terminal edit-mode vi [persist]
Example:
switch# terminal edit-mode vi
Controlling CLI History Recall
You can control the commands that you recall from the CLI history using the Ctrl-P and Ctrl-N keystroke
shortcuts. Cisco NX-OS software recalls all commands from the current command mode and higher command
modes. For example, if you are working in global configuration mode, the command recall keystroke shortcuts
recall both EXEC mode and global configuration mode commands.
Displaying the Command History
You can display the command history using the show cli history command.
The show cli history command has the following syntax:
By default, the number of lines displayed is 12 and the output includes the command number and timestamp.
OL-29291-02
configure terminal
show interface ethernet 2/24
interface ethernet 2/24
no shutdown
exit
show cli history
Purpose
Changes the CLI edit mode to vi for the user session. The persist
keyword makes the setting persistent across sessions for the current
username.
Use the no to revert to using emacs.
Cisco MDS 9000 Family NX-OS Fundamentals Configuration Guide
Configuring the CLI Edit Mode
63