While there are some graphical tools available to configure Cisco routers, the vast majority of Cisco device configuration involves entering commands at the IOS interface command line. Unfortunately, that often means a good amount of typing—and spending a large part of your day hacking away at the keyboard.
So what can you do to lessen that time? A good place to start is to work on speeding up your command-line skills.
The Cisco IOS offers a number of ways—built into the IOS—to make entering commands easier. For example, you can use the alias command to shorten the process and dispel some of the repetition.
However, as with anything at the command line, rarely will it tell you how it can help make your life easier. That's why it's a good idea to learn tricks that will make your life easier when entering commands. And if you ever take any of the CCIE lab exams, being able to type commands quickly will be imperative to passing the test.
Let's look at three ways you can speed up your command-line skills in the Cisco IOS interface.
One of the most frustrating things about quickly entering commands is that you can easily make a mistake. The quickest and easiest way to fix a mistake is pressing the up arrow key. This takes you to the previous command, where you can edit and fix the error.
You can also use this key to scroll through the previous 20 commands you've entered (20 is the default number). But keep in mind that each mode has a different command history. So, Privileged Mode (Router#) has one command history, while Global Configuration Mode (Router(config)#) has an entirely different history.
However, if you really want to, you can change the command history. Here's an example:
Router# term history size 256
Here's an example of the show history command:
Router# show history sh running-config view full show diag show show history show terminal conf t show logging conf t term history size 256 show history Router#
Cut it off
When looking for ways to speed up command entry, it's important to remember that the Cisco IOS will accept the least number of characters that match a unique command. I recommend taking advantage of this feature with every command you enter.
Let's look at some examples:
- Rather than entering the show ip route command, you can just type sh ip ro.
- Instead of entering the show running-configuration command, you can just type sh run.
- Rather than entering the show ip interface brief command, you can just type sh ip in brie.
The Cisco IOS will automatically complete any string of unique characters that you type when you press the [Tab] key. So, using one of our examples, you can type show run and press [Tab], and the IOS will resolve it to show running-configuration.
Use Cisco's built-in shortcuts
The Cisco IOS includes built-in features that allow the quick movement and editing of command strings. You can delete entire words, delete to the end of the line, and move the cursor to the beginning of the line, end of the line, or the third word in the line.
Here are some examples:
- Press [Ctrl]W to delete the previous word.
- Press [Ctrl]A to move to the beginning of the line.
- Press [Ctrl]E to move to the end of the line.
For a complete list of command-editing features, check out Cisco's Using the Command-Line Interface documentation.
Combine these tips for quicker command entry
Let's look at an example that uses all three of these tricks. Let's say you want to disable and then re-enable an interface, and you're in Interface Configuration Mode for this interface. First, type sh, and press [Enter]. This runs the shutdown command and disables the interface.
Next, you want to re-enable the interface. Press the up arrow key to find the sh command. Then, press [Ctrl]A (which takes you to the beginning of the line), and type no in front of sh, press the spacebar, and press [Enter]. This runs the no shutdown command and re-enables the interface. Using these shortcuts, you just disabled and re-enabled an interface by pressing a total of eight keys.
Miss a column?
Check out the Cisco Routers and Switches Archive, and catch up on David Davis' most recent columns.
Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!
David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.