Cisco IOS Tips and Tricks
- Tony Mattke
- Cisco
- May 27, 2009
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.
Command | Action |
---|---|
Ctrl+A | Move cursor to the beginning of the line |
Ctrl+E | Move cursor to the end of the line |
Up | Retrieve last command from history |
Down | Retrieve last command from history |
Ctrl+W | Erase previous word |
Ctrl+U | Erase the entire line |
Ctrl+C | Exit configuration mode |
Ctrl+Z | Apply 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.
Router# show run | begin bgp router bgp 65500 no synchronization ... ! end
Section includes only the section of the config you specify
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
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.
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.
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!