A recent thread on TechExams gave me the idea for a post on all the variations of the “show run” command. In this article I’ll go through the variations that I use the most, and some others that I don’t use much, but are pretty helpful.

Let’s take a look:

First we’ll look at all the options provided by IOS help:

EDGE#sh run ?
  all            Configuration with defaults
  brief          configuration without certificate data
  class-map      Show class-map information
  control-plane  Show Control-Plane information
  flow           Global Flow configuration subcommands
  full           full configuration
  interface      Show interface configuration
  linenum        Display line numbers in output
  map-class      Show map class information
  policy-map     Show policy-map information
  ssid           Show Dot11 SSID information
  view           View options
  vlan           Show L2 VLAN information
  vrf            Show VRF aware configuration
  |              Output modifiers

I’m sure everyone reading this has used good old “sh run” many times. What about the other options? I use “sh run interface” quite a bit:

EDGE#sh run int fa0/0
...
interface FastEthernet0/0
 description OUTSIDE
 ip address xx.xx.xx.xx 255.255.255.248
 ip access-group OUTSIDE_IN in
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 ip accounting access-violations
 ip nbar protocol-discovery
 ip nat outside
 ip virtual-reassembly
 load-interval 30
 duplex auto
 speed auto
 no cdp enable
 service-policy input QoS_IN
 service-policy output SHAPER
end

That and “sh run | section” are probably the variations I use most:

EDGE#sh run | sec ephone-dn
ephone-dn  1  dual-line
 number 5001 no-reg primary
 label Colby
 name Colby
ephone-dn  3
 number 5003 no-reg primary
 label Laptop
 name Colby-Laptop
ephone-dn  4
 number 5004 no-reg primary
 name Wireless
ephone-dn  5
 number 5005 no-reg primary
ephone-dn  6
 number 5006 no-reg primary
 name Katie
ephone-dn  11  dual-line
 number 555-555-5555
 label 555-555-5555
 name Colby

That one is perfect for times when you are looking for specific parts of the config, without having to wade through everything.

A new one I just learned from Networking-Forum:

EDGE#sh run
Building configuration...
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
/ospf <--- I typed this
filtering...
router ospf 200
 router-id 192.168.254.254
 log-adjacency-changes
 network 192.168.5.0 0.0.0.255 area 1
 network 192.168.13.0 0.0.0.3 area 0
 network 192.168.254.254 0.0.0.0 area 0

If you’ve used vi or vim in Unix/Linux, you’re probably familiar with this. You type “/search_string” and it will take you to the first line with that string. A neat little search function.

Now for the lesser used:

sh run all - this one will show you EVERYTHING, all the default commands that do not appear with a normal sh run
sh run brief - this command will cut out some of the filler that doesn't really need to be seen
sh run linenum - this gives you the line numbers of all your commands

The question that sparked this article was someone asking how to view a config without all the exclamation points (!). The answer was “show run | exclude !”. The exclude option can be quite helpful when used with many show commands.

So that’s it. Just a little rundown of the “show run” command. Hope someone finds this helpful.

Colby

Colby Glass has been in IT since 2002. He is currently a Systems Engineer (presales) with a Cisco Gold partner and holds the CCNP R/S, CCNP DC, CCDP, CCIP, JNCIA-ER.

More Posts