Using Command History
The CLI provides a history of commands that you have entered during the session. This is useful in recalling long and complex commands, and for retyping commands with slightly different parameters. To use the command history feature, you can perform the following tasks:
- Set the command history buffer size
- Recall commands
- Disable the command history feature
Setting the Command History Buffer Size
By default, the CLI records ten command lines in its history buffer. To set the number of command lines that the system will record during the current terminal session, and enable the command history feature, use the terminal history command: controller# terminal history [size n]
The terminal no history size command resets the number of lines saved in the history buffer to the default of ten lines or number specified by size.
To reset the history buffer size to its default (10), type default history: controller# default history
To display the contents of the history buffer, type terminal history
Using Command History
controller# terminal history
7 interface Dot11Radio 1 8 end
- interface Fast Ethernet controller 1 2
- show interface Dot11Radio 1
- end
- show interfaces FastEthernet controller 1 2
- sh alarm
- sh sec
- sh security
Recalling Commands
To recall commands from the history buffer, use one of the following commands or key combinations: • Ctrl-P or Up Arrow key. This recalls commands in the history buffer, beginning with the most recent command. Repeat the key sequence to recall successively older commands. • Ctrl-N or Down Arrow key. Returns to more recent commands in the history buffer after recalling commands with Ctrl-P or the Up Arrow key.
- !number. Execute the command at the history list number. Use the terminal history or show history commands to list the history buffer, then use this command to re-execute the command listed by its sequence number.
- To list the contents of the history buffer, use the show history command: controller# show history
Disabling the Command History Feature
The terminal history feature is automatically enabled. To disable it during the current terminal session, type no terminal history in either privileged or non-privileged EXEC mode: controller# no terminal history