Over the years, I've offered a ton of Cisco IOS tips and tricks in the Cisco Routers and Switches newsletter. However, some of the best tips are too short to support a full-length article. This week, I want to share five quick tips for using the Cisco IOS that will help make you a more efficient network admin.
#1: Cut yourself off
I assume that just about everyone who uses the Cisco IOS also knows that it accepts the fewest unique letters that represent a valid IOS command. However, I still notice some network admins typing out entire commands or even more letters than they have to.
If you add up all the time it takes to enter those unneeded letters, how much time have you wasted? Here are a couple examples of command uniqueness:
- show ip route = sh ip ro
- show running-configuration = sh run
- show ip ospf = sh ip o
On another note, why not use the shortest command for the job? Instead of using copy running-configuration startup-configuration or even co run start, why not use wr? The old write command actually does the same thing, but it's a lot fewer characters to type.
Even better, why not make these little short commands into aliases? Check out "Enter commands more efficiently with Cisco command aliases" to learn more.
#2: Make time work for you
Many times, router events can happen so quickly that multiple events happen in the same second (especially on large routers that have a lot of routes). To make sure your log can tell you exactly what happened at what time, use this command: service timestamps log datetime localtime show-timezone msec year.
This command make sure the router timestamps all of your logging messages with the current time, the time zone (for those of you with remote routers in different time zones), the millisecond that the event occurred, and the year. (For those whose routers don't usually have many events, it can be nice to know the year.)
Here's what the timestamp looks like (without the year):
*Oct 21 15:31:54.955 CDT: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down
In addition, you can use the service sequence-numbers command to include an absolute number that identifies each event and shows the sequence that events occurred. Entering this command tells the router to add a number next to each logging message, which both identifies that event and orders the events by numbered sequence.
#3: Start with a clean slate
Let's say you've configured an interface on your router but later decide that you want to reconfigure it. Without having to remove what you set, command by command, or without having to wonder which commands you added and which were defaults, you can quickly bring a single interface back to its "default" configuration in one command. Just use the default interface command, as in default interface Fa0/0.
#4: Change your filter
If you're a Linux admin, you know how to "pipe things to more" or "filter with grep," right? It amazes me when I see Cisco admins who look through a huge running-configuration when they know what they're looking for.
The next time you're looking for something in a Cisco IOS command output, use begin or include. For example, to start at the OSPF configuration, use sh run | beg router ospf. Or, to show all IP addresses configure on the router, use sh run | inc ip address.
You can also use exclude. Trust me, there are a million ways to use these command-filtering techniques.
#5: Just do it
How many of you tend go to back and forth from Global Configuration to Privileged Mode to configure things as opposed to show things? (I admit it, I'm holding up my hand.) It's a habit, right? It's how we learned to configure the IOS -- always changing from "configuration mode" to "show mode."
It's time to break that habit and start saving time by using the do command. This command allows you to run Privileged Mode commands from Global Configuration Mode. Even better, it's short -- a whole lot shorter than exiting back to Privileged Mode, entering your command, and then going back to Global Configuration Mode.
All you have to do is use do in front of the command. Using this command, you can perform any exec mode (Privileged Mode) command from any of the Global Configuration Mode prompts.
Let's say you're configuring OSPF and want to see if your neighbors came up. Here's an example:
Router(config)# router eigrp 100 Router(config-router)# do sh ip ei nei
IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq2 10.1.1.1 Fa0/0 13 00:52:47 88 2280 0 6581
Finding ways to do your job more efficiently is always important. These five quick tips will help you accomplish the same Cisco IOS tasks you're already doing -- but more quickly and easily by using some Cisco IOS commands that you may not have been aware of.
Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!