Cisco IOS Tips and Tricks

Cisco IOS Tips and Tricks

So, I’m sure these have been posted almost on every networking blog under the sun, but who knows, right? Here are a few tips and tricks to help you move around the IOS a bit faster, find information faster, and locate problems… faster.

Keyboard Shortcuts

If you’re anything like me, having to switch between the keyboard mouse feels like such a waste of time. If I can do it from the keyboard I will! I’m still waiting for a way to use photoshop 100% from the keyboard.. but I digress. These are the keyboard shortcuts I find myself using the most.

CommandAction
Ctrl+AMove cursor to the beginning of the line
Ctrl+EMove cursor to the end of the line
UpRetrieve last command from history
DownRetrieve last command from history
Ctrl+WErase previous word
Ctrl+UErase the entire line
Ctrl+CExit configuration mode
Ctrl+ZApply the current command and exit configuration mode

Modifying output

You may of seen the | symbol listed as an option when using IOS help, but have you ever used it? You will now. The options for filtering include begin, section, exclude and include.

Begin filters everything until the first instance of your specified pattern.

text
Router# show run | begin bgp
router bgp 65500
 no synchronization
...
!
end

Section includes only the section of the config you specify

text
Router# show run | section int
interface FastEthernet0/0
 no ip address
 shutdown
 speed auto
 duplex auto
interface FastEthernet0/1
 no ip address
 shutdown
 speed auto
 duplex auto

Exclude filters lines that match your pattern

text
Router# show run | exclude !
Building configuration...

Current configuration : 754 bytes
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
hostname Router
boot-start-marker
boot-end-marker
no aaa new-model
...
end

Include only includes lines that match your pattern. I realized that until now I have only included output from show run, and I have yet to mention that your pattern can contain regular expressions. So I will show you two examples of this being used.

text
Router# show run | inc ^interface|ip address
interface FastEthernet0
 ip address 192.168.0.1 255.255.255.0
interface FastEthernet1
 ip address 192.168.1.1 255.255.255.0
 ip address 10.1.1.1 255.255.255.0 secondary

Here is a second example that shows what interfaces have ACLs applied. In a future post I will dive deeper into regular expressions.

text
Router# sh ip int | inc line protocol|access list is [^ ]+$
FastEthernet0 is up, line protocol is up
  Inbound access list is deny10
FastEthernet1 is up, line protocol is up
  Inbound access list is 11
FastEthernet2 is up, line protocol is up

I hope some of these tips will help you out, in the future I will continue to publish more tidbits that will help you optimize your configurations. If you think I’ve left anything out, please comment below!

comments powered by Disqus

Related Posts

Network Design — Keeping it simple

Network Design — Keeping it simple

Since the dawn of time people have skirted best practice and banged together networks, putting the proverbial square peg in the esoteric round hole. For example, new vendor XYZ’s …

SNMP can save your life

SNMP can save your life

Ever get locked out of a router or switch that is many hours or even days away? Recently, I had the pleasure, again. For some reason, be it the consultant that was turning up our …

Ixia Vision ONE – Tap the Planet

Ixia Vision ONE – Tap the Planet

Whenever I start talking about network visibility and aggreagation taps I can’t help but think of The Matrix. Millions of packets flowing through your network every minute of every …