01 June, 2014

How To Get Small Output

R1#show processes cpu | include IP Input
  80           0         2          0  0.00%  0.00%  0.00%   0 IP Input

R1#show processes cpu | include ^CPU|IP Input
CPU utilization for five seconds: 1%/0%; one minute: 0%; five minutes: 0%
  80           0         2          0  0.00%  0.00%  0.00%   0 IP Input

R1#show processes cpu | include ^CPU|PID|IP Input
CPU utilization for five seconds: 0%/0%; one minute: 1%; five minutes: 0%
 PID Runtime(ms)   Invoked      uSecs   5Sec   1Min   5Min TTY Process
  80           0         3          0  0.00%  0.00%  0.00%   0 IP Input

R1#show inter fas 0/0 | in ^Fas|MTU|Duplex
FastEthernet0/0 is administratively down, line protocol is down
  MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,

R1#show inter fas 0/0 | in ^Fas|MTU|duplex
FastEthernet0/0 is administratively down, line protocol is down
  MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,
  Half-duplex, 10Mb/s, 100BaseTX/FX

R1#show inter fas 0/0 | in ^Fas|MTU|duplex|errors
FastEthernet0/0 is administratively down, line protocol is down
  MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,
  Half-duplex, 10Mb/s, 100BaseTX/FX
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 output errors, 0 collisions, 0 interface resets

R1#show inter fas 0/0 | in ^Fas|MTU|duplex|packets
FastEthernet0/0 is administratively down, line protocol is down
  MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,
  Half-duplex, 10Mb/s, 100BaseTX/FX
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes
     0 input packets with dribble condition detected
     0 packets output, 0 bytes, 0 underruns

R1#show inter fas 0/0 | in ^Fas|MTU|duplex|errors|packets
FastEthernet0/0 is administratively down, line protocol is down
  MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,
  Half-duplex, 10Mb/s, 100BaseTX/FX
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 input packets with dribble condition detected
     0 packets output, 0 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets

R1#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
R2.lab.local     Fas 0/0            167        R S I      3725      Fas 0/0
R3.lab.local     Fas 0/1            167        R S I      3725      Fas 0/0
R4.lab.local     Fas 0/1            167        R S I      3725      Fas 0/0
R5.lab.local     Fas 1/1            167        R S I      3725      Fas 0/0
R6.lab.local     Fas 1/1            167        R S I      3725      Fas 0/0
R7.lab.local     Fas 0/1            167        R S I      3725      Fas 0/0
R8.lab.local     Fas 0/1            167        R S I      3725      Fas 0/0
R9.lab.local     Fas 0/1            167        R S I      3725      Fas 0/0

R1#show cdp neighbors | include ^Device|R2
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
R2.lab.local     Fas 0/0            148        R S I      3725      Fas 0/0

R1#show interfaces | in (is)
FastEthernet0/0 is up, line protocol is up
  Hardware is Gt96k FE, address is c200.1924.0000 (bia c200.1924.0000)
  Internet address is 10.10.10.1/24
     0 output errors, 0 collisions, 1 interface resets
     0 babbles, 0 late collision, 0 deferred

R1#show interfaces | in ( is )
FastEthernet0/0 is up, line protocol is up
  Hardware is Gt96k FE, address is c200.1924.0000 (bia c200.1924.0000)
  Internet address is 10.10.10.1/24


show run | i ^interface|^_ip address
! Gives you the every line in your running config that starts with (that’s what the ^ is all about) “interface” or ” ip address”, essentially giving you all of your interface IP’s in an IOS-pastable format.  The underscore represents a space.  Useful for displaying IP addresses with their associated masks and interfaces.

show ip interf brief | e unassigned
! Shows you all of the IP-capable interfaces on the box, except for the ones that have not been assigned an IP address.  I use this often, especially on big switch/routers where most of the physical interfaces do not have an IP addresses, but the SVIs do.

show run | i ip route.*Serial1/1
! Shows you all static routes in your configuration pointing out Serial1/1, no matter what they are.  Substitute your own interface name.  Useful if you’re doing clean up after decommissioning an interface where you didn’t run a dynamic routing protocol.

show interf status | i Gi[2-6]/20
! Shows you the status of all port 20s in slots 2-6 of a chassis with gig cards.  Putting the 2-6 in square brackets is a regex telling the parser that any character that’s 2 through 6 inclusive is a match.

show interf status | i Gi[246]/20
! Shows you the status of all port 20s in slots 2, 4, and 6 of a chassis with gig cards.  Here, [246] tells the parser that values 2, 4, or 6 are all matches for that position.

show interf status | i Gi./2_
! Shows you the status of all ports ending in 2.  The underscore represents a space, so this makes sure you don’t get a match for “20″ or “22″ when all you really want is “2″.  The dot is a wildcard, allowing for any single character in that position.  If you want to match a random number of additional wildcard characters, follow the dot with an asterisk.

show interf status | i Gi7/(29|3[0-9])
! Shows you the status of all ports in slot 7, 29 – 39 inclusive.  You get the “Gi7/”, right?  No regex magic there.  The “29|” could be translated “29 or”.  The “3[0-9]” could be translated “3 followed by any of the digits 0 through 9 inclusive”.  Put it all together, and you get a match for any line containing Gi7/, followed by 29 or 30-39.

show interf status | i _101_
! Displays all lines contain the number 101 with a leading and trailing space.  Useful if you want to show all the ports in a particular VLAN, in this case 101.

show inter status | i a-100_|_100_
! Displays all the ports that are running at 100Mbps, whether statically defined or auto-negotiated.  Will also match interfaces in Vlan100, though.  Sadly, Cisco does not allow you to pipe to “include” and then further pipe to “exclude”, such as you can do in *nix by nesting piped greps.  If you could nest your pipe commands in the IOS CLI, there could be some very interesting output filters generated.

show interface | i line|escription|bits
! Presents all interfaces, their descriptions, and the bits per second flowing through them, both input and output.  Does not distinguish between up/down status.