You are on page 1of 12

Expert Reference Series of White Papers

Cisco IOS Command Shortcuts

1-800-COURSES

www.globalknowledge.com

Cisco IOS Command Shortcuts


Raj Tolani, Global Knowledge Instructor

Introduction
Once you start using the Cisco IOS, you learn there are many commands that can do various things, and many of these have parameters and even sub-parameters. This could be very cumbersome if you are managing Cisco Routers in real life (especially for the typing challenged among us). This white paper contains some tips and shortcuts Ive collected over the years that will make your life a little easier. Note: The goal in this white paper is not to teach you what the commands do or show. Instead, I am simply showing you how the addition of parameters to these commands will make your life easier. For example, if I show you the BGP command to restrict your output and specifically see certain components we assume you already understand BGP. We will not be covering the output to go into the BGP parameters (or any other protocol used in these examples).

Show running-config
Many of us have been using the Show running-config command. We know that this will show us what is currently running. But if I only wanted to see what was currently running for a specific interface, then it makes sense to see just the part that pertains to that particular interface, rather than the entire running-config, which could be multiple pages. Lets see the example. Here is the output of show running-config on a simple router
Building configuration... Current configuration : 728 bytes version 12.4 service timestamps debug datetimemsec service timestamps log datetimemsec no service password-encryption hostname Router boot-start-marker boot-end-marker

Copyright 2010 Global Knowledge Training LLC. All rights reserved.

noaaa new-model memory-sizeiomem 5 ipcef ipauth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 interface FastEthernet0/0 ip address 1.1.1.1 255.255.255.0 duplex auto speed auto interface FastEthernet0/1 ip address 2.2.2.1 255.255.255.0 duplex auto speed auto <output omitted> ip forward-protocol nd ip http server no ip http secure-server control-plane line con 0 password cisco login line aux 0 no exec linevty 0 4 password cisco login end

But, if I only care about the output of the configuration for interface FastEthernet 0/1, then I would do the following instead.
Router#show runint fa 0/1 Building configuration... Current configuration : 92 bytes interface FastEthernet0/1 ip address 2.2.2.1 255.255.255.0 duplex auto speed auto end

Copyright 2010 Global Knowledge Training LLC. All rights reserved.

This makes things easy since I can focus on the output for that specific interface configuration. Sometimes, I dont care about all pages in the running configuration, I just care about output starting with the line that says line con 0. Instead of looking at the entire multiple-page running-config I would rather do the following.
Router#show run | begin line con 0 line con 0 password cisco login line aux 0 no exec linevty 0 4 password cisco login end

This is great! I only see the output beginning from line con 0 in the configuration. But, for some, even this might be too much information. Maybe I only care about the section that pertains to line con 0. To make that happen, I would do the following.
Router#show run | section line con 0 line con 0 password cisco login Router#

I like the command with the parameter section at the end because it helps me out with routing protocols too. Let me give you an example of what I mean.
Router#show run | section router eigrp routereigrp 100 network 1.0.0.0 network 2.0.0.0 auto-summary Router#

I have seen sections used as shown here in various CCNP classes, but I like using the parameter section, not router eigrp, and limiting myself to seeing the EIGRP parameters like AS # and network commands (things under router configuration mode) but instead use the following..
Router#show run | section eigrp ip summary-address eigrp 100 10.0.0.0 255.255.255.0 5 routereigrp 100 network 1.0.0.0
Copyright 2010 Global Knowledge Training LLC. All rights reserved. 4

network 2.0.0.0 auto-summary Router#

By just putting the word eigrp, I can see other EIGRP -related things configured. In this example, I add additional parameters, like summarization. Other examples could be if you have some EIGRP related SNMP traps you have configured they will also show up.

Include and Exclude


The other parameter I can use is the include parameter. Using the include parameter, I can restrict the lines to ones that include the words ip address. Lets see the output.
Router#show run | include ip address ip address 1.1.1.1 255.255.255.0 ip address 2.2.2.1 255.255.255.0 Router#

Another useful parameter is exclude, which, as you might expect, will do the opposite of include. This will show me every line except for the lines that contain the words ip address.
Router#show run | exclude ip address Building configuration... Current configuration : 870 bytes version 12.4 service timestamps debug datetimemsec service timestamps log datetimemsec no service password-encryption hostname Router boot-start-marker boot-end-marker noaaa new-model memory-sizeiomem 5 ipcef no ip domain lookup ipauth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 interface FastEthernet0/0 ip summary-address eigrp 100 10.0.0.0 255.255.255.0 5 duplex auto speed auto

Copyright 2010 Global Knowledge Training LLC. All rights reserved.

interface FastEthernet0/1 duplex auto speed auto routereigrp 100 network 1.0.0.0 network 2.0.0.0 auto-summary ip forward-protocol nd ip http server no ip http secure-server control-plane line con 0 password cisco login line aux 0 no exec linevty 0 4 password cisco login end Router#

Often I hear students say that their IOS might or might not support the little shortcuts we mentioned here, but that might not be entirely true. Have you ever noticed that when you do the show run command (and you have not changed the norms), then your system will show you the first page of output followed by More. You can move through the commands and pages by doing the following. Spacebar to move one page at a time, Enter Key (carriage return) to move one line at a time or Q to quit out of the output. But, you can also type other parameters to find the one you need. / does the equivalent of begin + does the equivalent of include - does the equivalent of exclude

Show ip int brief


The other commonly used command in the Cisco world is show ip int brief. This gives the Layer 1, Layer 2, and Layer 3 information without all the other gory details. The problem is: What happens if I have too many interfaces, or if I just want to look at a specific interface?
Copyright 2010 Global Knowledge Training LLC. All rights reserved. 6

Router#show ip int brief | inc FastEthernet0/0 FastEthernet0/0 up Router# 1.1.1.1 YES manual up

Or, maybe I am configuring IP addresses on my interfaces, but I have been working on too many and, after a long hard day, I cant remember which interfaces Im done with and which I have left.
Router#show ip int brief | inc unassigned FastEthernet0/1 up Router# unassigned YES manual up

Case Sensitivity
Have you noticed that I have been very specific about the case sensitivity of the parameter Im putting in these commands? For example, in the word FastEthernet the F and E are uppercase because this is how the system shows it. In the last example, I was looking for unassigned in all lowercase. What if I dont know if it should be uppercase or lowercase?
Router#show ip int brief | inc UNASSIGNED Router# Router#show ip int brief | inc (UNASSIGNED|unassigned) FastEthernet0/1 up Router# unassigned YES manual up

As you can see that there was no output when I had the word UNASSIGNED (all uppercase) but when I put in the OR operation looking for UNASSIGNED OR unassigned it gave me the output I was looking for.

Show ip bgp
If you have been using regular expressions, you might already be familiar with these operations. You can use more regular expressions currently in the BGP world. For example, instead of doing show command to see the hundreds of thousands of routes, I can maybe do the following.
Show ip bgpregexp _80$ route-server>show ip bgpregexp _80$ BGP table version is 84415369, local router ID is 12.0.1.28 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete
Copyright 2010 Global Knowledge Training LLC. All rights reserved. 7

Network * 3.0.0.0 2828 6181 80 i * 3356 6181 80 i * 3356 6181 80 i *> 3356 6181 80 i * 2828 6181 80 i

Next Hop 12.123.29.249 12.123.13.241 12.123.37.250 12.123.1.236 12.123.145.124

Metric LocPrf Weight Path 0 7018 0 7018 0 7018 0 7018 0 7018

<output omitted>
* 2828 6181 80 i * 2828 6181 80 i * 2828 6181 80 i * 3356 6181 80 i * 3356 6181 80 i * 3356 6181 80 i * 3356 6181 80 i * 3356 6181 80 i * 3356 6181 80 i * 3356 6181 80 i * 3356 6181 80 i 12.123.33.249 12.123.142.124 12.123.21.243 12.123.134.124 12.123.17.244 12.123.41.250 12.123.137.124 12.123.5.240 12.123.45.252 12.123.25.245 12.123.139.124 0 7018 0 7018 0 7018 0 7018 0 7018 0 7018 0 7018 0 7018 0 7018 0 7018 0 7018

As you can see, I am keying in on the AS_Path attribute in the output of the show ipbgp command and am able to see ONLY the prefixes that originated in AS 80 indicated by the Number 80 in the extreme right side of the AS_Path attribute.

DO Command
As you can see, I have been typing the commands like Show running-config and show ip interface brief at the privilege exec mode (Router#). What if I am in the middle of my configurations and have made changes to numerous interfaces, and then I want to do one of these commands? Well, you can do that without exiting
Copyright 2010 Global Knowledge Training LLC. All rights reserved. 8

out completely by using the DO command. DO command will let you do the things that you were previously not able to do here in these modes. For example:
Router# Router#show ip int brief Interface Protocol FastEthernet0/0 up FastEthernet0/1 up Router#conf t Enter configuration commands, one per line. Router(config)#interface fa 0/0 Router(config-if)#show ip int brief ^ % Invalid input detected at ^ marker. Router(config-if)#do show ip int brief Interface Protocol FastEthernet0/0 up FastEthernet0/1 up Router(config-if)# IP-Address 1.1.1.1 unassigned OK? Method Status YES manual up YES manual up End with CNTL/Z. IP-Address 1.1.1.1 unassigned OK? Method Status YES manual up YES manual up

So, this works out fine when we put in the word DO before the command. But, even though DO is letting you perform these commands here, you have to know the syntax of the command. Help wont work here because its not where the command really belongs; likewise, the autocomplete function using the TAB key is unavailable as well.

Aliases
Another shortcut that can make your life easier is the creation of aliases. Consider the command show ip interface brief. Even though we know how to type, that is a lot of typing. And if you start using commands with parameters and subparameters, it could quickly become too much typing if you are doing it every day, all day. You can create aliases that can be used at different modes. I have created two in my example. 1. test which upon typing in Privilege Exec mode will run the show ip int brief command 2. test2 which upon typing in the interface configuration mode will run the show ip int brief command

Copyright 2010 Global Knowledge Training LLC. All rights reserved.

Of course, in a real environment, I would use something like siib as an alias for show ip int brief instead of test. Let me show you the commands to create the alias and the use of those aliases.
Router# Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#alias exec test show ip int brief Router(config)#alias interface test2 do show ip int brief Router(config)# Router(config)#end Router# *Mar 1 01:29:03.835: %SYS-5-CONFIG_I: Configured from console by console Router#test Interface IP-Address OK? Method Status Protocol FastEthernet0/0 1.1.1.1 YES manual up up FastEthernet0/1 unassigned YES manual up up Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#int fa 0/1 Router(config-if)#test2 Interface IP-Address OK? Method Status Protocol FastEthernet0/0 1.1.1.1 YES manual up up FastEthernet0/1 unassigned YES manual up up Router(config-if)#end Router#show aliases Exec mode aliases: h help lo logout p ping r resume s show uundebug unundebug w where test show ip int brief Interface configuration mode aliases: test2 do show ip int brief Router#

Copyright 2010 Global Knowledge Training LLC. All rights reserved.

10

Defaults
Many times in your environment you might have interfaces that were once used for a Purpose A but now have to be reassigned to Purpose B. You need to remove the older parameters from them in order to enter the new information. Yes, you could simply say NO to each parameter and the new configuration variables for this new purpose, but what if there were ten or fifty things keyed in on the interface? I hope you are not planning on saying NO to fifty commands My favorite solution is the use of the default command. Let me show you an example.
Router#show run interface fa 0/0 Building configuration... Current configuration : 181 bytes interface FastEthernet0/0 description Test Link ip address 1.1.1.1 255.255.255.0 ip summary-address eigrp 100 10.0.0.0 255.255.255.0 5 speed 10 half-duplex keepalive 5 end Router#

Now, check this out.


Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#default interface fa 0/0 Building configuration... Interface FastEthernet0/0 set to default configuration Router(config)#do show run int fa 0/0 Building configuration. Current configuration : 73 bytes interface FastEthernet0/0 no ip address duplex auto speed auto end Router(config)#

As you can see, this interface has been set to a factory default configuration. You can also use this parameter on switches that support the interface range parameter and set several interfaceseven across different line cardsto their factory defaults.

Copyright 2010 Global Knowledge Training LLC. All rights reserved.

11

So, now that we know a couple of these tricks/shortcuts, how many of them can we use in the real exam simulations? Well, unfortunately these will only help you in an exam where you have access to real routers which at the moment is just the CCIE lab exam. The associate and professional level exams are simulations, not real routers. In the simulations you can only do what it was programmed to do. In these exams you can abbreviate the commands, meaning you can type shoipint brief rather than spell out the words in the commands. You can also press the TAB key to autocomplete, and you can type ? in the commands to see what parameters are allowed. But the last I checked using an alias is not an allowed option, nor is the DO command.

Summary
I hope these little tricks and tips help you manage your environment. For more information on technologies covered in this white paper and to understand the outputs used in these scenarios, consider taking the CCNP track through Global Knowledge.

Learn More
Learn more about how you can improve productivity, enhance efficiency, and sharpen your competitive edge. Check out the following Global Knowledge course(s): Route Implementing Cisco IP Routing v1.0 Switch Implementing Cisco IP Switched Networks v1.0 CCNA-TS Troubleshooting Cisco Internetworks for Network Associates For more information or to register, visit www.globalknowledge.com or call 1-800-COURSES to speak with a sales representative. Our courses and enhanced, hands-on labs and exercises offer practical skills and tips that you can immediately put to use. Our expert instructors draw upon their experiences to help you understand key concepts and how to apply them to your specific work situation. Choose from our more than 1,200 courses, delivered through Classrooms, e-Learning, and On-site sessions, to meet your IT and business training needs.

About the Author


Dheeraj (Raj) Tolani has been working with Global Knowledge as a contract instructor teaching various networking courses including CCNA, CCDA, CCNP, CCDP, CCIP, CCVP tracks. He has been in the industry for over 17 years working with various technologies and multiple vendors including Cisco, Banyan Vines, Microsoft, Comptia and Novell. Dheeraj has worked as a consultant for various medical, financial, legal, government, and publishing companies. He runs a consulting company based out of New York City, which provides IP integration solutions. You can visit his web site at www.rajtolani.com

Copyright 2010 Global Knowledge Training LLC. All rights reserved.

12

You might also like