--

IOS Tips and Tricks, Part 2

Continuing with our examples of IOS Command Line Interface (CLI) tips, here are the new and old versions of several config-related commands, along with some common shortcuts. Note that these shortcuts are not necessarily the most concise possible. Use the question mark to find shortcuts that you like.

To see the startup config (stored in NVRAM):

New#show startup-config (“s start”)

Old#show config (“s conf”)

Note that “show config” does not display the running config, it displays the startup config. To erase the startup config:

New#erase startup-config (“erase start”)

Old#write erase (“wr er”)

To display the running config (also referred to as the “active” or “current” config):

New#show running-config (“s run”)

Old#write terminal (“wr t”)

To save the running config to NVRAM:

New#copy running-config startup-config (“copy run start”)

Old#write memory (“wr”, you don’t need the “mem”)

Although Cisco no longer officially endorses the old commands (due to confusion over what “show config” does), you might see “old-timers” using them, especially “wr”. Why type fourteen or so keystrokes (“copy run start”) when two (“wr”) will do?

Speaking of configurations, to display only the lines of the running config that contain a specific alphanumeric string (such as “rip”), “pipe” it into “include”:

Router#show run | include rip (“s run | in rip”)

The “pipe” (redirect) symbol (which looks like a vertical bar) is often found as a shifted backslash, above the “Enter” key. To display the section of the running config that begins with a specific alphanumeric string (for example, “ospf”), pipe it into “begin”:

Router#show run | begin ospf (“s run | beg ospf”)

Among other options, you can also do an “exclude” (show all lines that do not include the string). Use the question mark to see the other options:

Router#s run | ?

Router#s start | ?

Note that the “include”, “begin” and “exclude” options are case-sensitive. To display the section of the running config for a specific interface or subinterface, you could pipe it into “begin”, but you have to identify the interface exactly as it appears in the config:

Router#s run | beg FastEthernet0/0

The problem with this is that you can’t shortcut the interface type (for example, “fa”), and the search string is case-sensitive. A slicker way to display the interface-specific config info is:

Router#s run int fa0/0

When you use this option, it’s not case-sensitive, and you don’t have to bother with the “pipe”. Although you can shortcut it, you do have to be precise when specifying the interface identifier. For example, if you want to display the Serial 1/2.345 subinterface config, this will work:

Router#s run int s1/2.345

But this will not:

Router#s run int s1/2.3

As always, no shortcutting of variables! These options also work when viewing the startup config. And speaking of “show start”, you can also display the startup config with line numbers, which can sometimes be handy when reviewing or discussing it:

Router#s start linenum (“s star li”)

As with “show run”, you can use the question mark with “show start” to see any other available options:

Router#s run ?

Router#s star ?

Some IOS features require PKI certificate data, which appears in the running config as a large block of nonsense text. To bypass the PKI certificate data when displaying the running config, use the “brief” option:

Router#s run brief

Remember, when the output of any “show” command displays “–More–” at the bottom, you have several options:

To see the next line, hit the “Enter” key

To see the next screen, hit the spacebar

To return to the CLI prompt, hit any other alphanumeric key

Finally, don’t forget that you can use the “Tab” key to complete keywords (but not variables, of course). Next time, we’ll examine additional useful CLI tips and tricks.

RELATED ARTICLES

A recent student question in an Implementing Cisco Intrusion Prevention Systems class prompted me to write this article. I would paraphrase that question: “How can I configure a signature to look for a defined sequence of characters at a fixed depth within the packet?” The basis for the query was a very legitimate concern for possible …
Read More

As an engineering professional, I've been using the Cisco Internetwork Operating System (IOS) since I entered the industry in 1998. Naturally, IOS formed the bedrock of Cisco networking technologies and...

Most Cisco customers would naturally recognize that the ASA Security appliance is THE platform on which to implement SSL VPN types of any sort (clientless or using the AnyConnect® client)....

CONNECT WITH US

CATEGORIES

Global Knowledge is the worldwide leader in IT training and learning services. We empower organizations, teams and individuals with the skills and best practices necessary to leverage the technologies and competencies critical for sustained success. With over 15 corporate offices around the world, our 1,500 employees are helping clients succeed in over 100 countries. Learn more at www.globalknowledge.com.