The Terminal History Command

The commands for moving back and forth on the command line are pretty self-explanatory. However, some of the commands listed in Table 1 are especially useful. For example, the up and down arrows allow you to scroll through previous commands, much like you might be familiar with from the Windows or Linux command line.

If you do choose to scroll through commands regularly, you may want to control how many commands are stored in the router’s command history. Conversely, you might feel that the command history feature represents a security threat – another user could easily view recently issued commands if you were to step away from the router momentarily without logging off. In that case, you can also turn the command history off.

Configuring terminal history settings can be accomplished from both user mode and privileged mode. By default, the command history feature is enabled, and is set to show the last 10 commands entered. To verify this, use the show terminal command. I’ve eliminated most of the command’s output in the example below to show only the data relevant to terminal history settings.

toronto-1>show terminal
History is enabled, history size is 10.

In order to actually view the command history, use the show history command:

toronto-1>show history
show int e0
show int s1
show int s0
show history
help
show history
show sessions
sh ver
sh term
sh history
toronto-1>

You can also set the command history to a larger or smaller size. To set the command history to buffer the last 20 commands issued, use the terminal history size command.

toronto-1>term his size 20

Notice that in the example above, I entered shorthand versions of the first two parts of the command. Instead of entering terminal history size 20, I simply truncated it to a shorter version that still provided enough information to not be considered ambiguous by the router.

Finally, if you want to turn the terminal history feature off, enter the command:

toronto-1>terminal no history

Terminal history can easily be re-enabled by issuing the command terminal history.

Author: Dan DiNicolo

Dan DiNicolo is a freelance author, consultant, trainer, and the managing editor of 2000Trainers.com. He is the author of the CCNA Study Guide found on this site, as well as many books including the PC Magazine titles Windows XP Security Solutions and Windows Vista Security Solutions. Click here to contact Dan.