Placed

100 mg sildenafil

Pips and Filters with Cisco Show Command

Posted by: admin  :  Category: Routing, Security, Switching




102_1746

Cisco’s IOS show command can provide a lot of information. Although most of the time this information is much more the you need, so Cisco has provided a way to pipe the information through filters. Just like on Linux, you can use the pipe (|) to pass the show output to filters and display only the information you need.

The syntax for using the pipe is Show command | filter regular-expression. There are several filters that can be used to display information in different ways.

Began (Show command | began regular-expression):

Example:
ASW1#Show interface | began GigabitEthernet
GigabitEthernet0/1 is up, line protocol is up (connected)
  Hardware is Gigabit Ethernet, address is fc99.47c4.1181
  Description: Uplink to  - R1
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, media type is 10/100/1000BaseTX
  input flow-control is off, output flow-control is unsupported
  ARP type: ARPA, ARP Timeout 04:00:00
.
.
.
.

Include (Show command | include regular-expression):

The most useful function is the include filter. This is will show you only lines that match a string that you give it. Say that you want to find the status of the GigabiEthernet ports on your switch, but don’t want to grind through all the lines of a show ip interface brief. If you just pipe it to the include command followed by the word “Interface”, you’ll see something like this.

Example:
ASW1#show interfaces | include GigabitEthernet
GigabitEthernet0/1 is up, line protocol is up (connected)
GigabitEthernet0/2 is up, line protocol is up (connected)
.
.
.
GigabitEthernet0/47 is up, line protocol is up (connected)
GigabitEthernet0/48 is up, line protocol is up (connected)
GigabitEthernet1/1 is up, line protocol is up (connected)
.
.
GigabitEthernet1/4 is down, line protocol is down (notconnect)
TenGigabitEthernet1/1 is down, line protocol is down (notconnect)
TenGigabitEthernet1/2 is down, line protocol is down (notconnect)

Exclude (Show command | exclude regular-expression):

Example:
ASW1#Sho cdp neighbors | exclude SEP          
Capability Codes:R - Router, T - Trans Bridge, B - Source Route Bridge
                 S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
                 D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID    Local Intrfce     Holdtme    Capability  Platform  Port ID
R3             Gig 1/1           133        R S I     WS-C3560X Gig 1/1
R1             Gig 0/1           137        R S I     3845      Gig 0/0
R2             Gig 1/2           156        R S I     WS-C3560X Gig 1/1
WAP1           Gig 4/1           130            T     AIR-CAP35 Gig 0
WAP2           Gig 4/2           130            T     AIR-CAP35 Gig 0

Section (show running-config | section include regular-expression):

Example:
ASW1#show running-config | section include interface
interface FastEthernet0
 no ip address
 no ip route-cache cef
 no ip route-cache
 no ip mroute-cache
!
interface GigabitEthernet0/1
 description Uplink to  - R1
 switchport trunk encapsulation dot1q
 switchport trunk native vlan 1000
 switchport mode trunk
 no logging event link-status
 speed 100
 duplex full
 priority-queue out
 no snmp trap link-status
 no mdix auto
 ip dhcp snooping trust
.
.
interface GigabitEthernet1/1
 description Uplink to R2
 switchport trunk encapsulation dot1q
 switchport trunk native vlan 1000
 switchport mode trunk
 srr-queue bandwidth share 1 30 30 30
 srr-queue bandwidth shape 30 0 0 0
 priority-queue out
 mls qos trust dscp
 ip dhcp snooping trust
!
interface Vlan100
 no ip address
 service-policy input DATA-VLAN
!
interface Vlan500
 no ip address
 service-policy input VOICE-VLAN

In conclusion Cisco’s show command combined with pipes and filters can reduce the amount of information you need to wade through find what you are looking for therefore saving time and money.

Leave a Reply

*

What is 15 + 13 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)
http://s51.sitemeter.com/meter.asp?site=s51ciscolab Site Meter