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.
Author: Al Friebe