Cisco IOS - advanced operations (navigation+include)

source: http://routerjockey.com/2009/05/27/cisco-ios-tips-and-tricks/

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.

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 next 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

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 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!