How about you? I’d love to see your clever commands in the comments. I use these features all the time to more quickly parse through router and switch output. I view this list as “a good start”, leveraging basic regex features. Does not distinguish between up/down status. Show interface | i line|escription|bits ! Presents all interfaces, their descriptions, and the bits per second flowing through them, both input and output. If you could nest your pipe commands in the IOS CLI, there could be some very interesting output filters generated. 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. Will also match interfaces in Vlan100, though. Show inter status | i a-100_|_100_ ! Displays all the ports that are running at 100Mbps, whether statically defined or auto-negotiated. Useful if you want to show all the ports in a particular VLAN, in this case 101. Show interf status | i _101_ ! Displays all lines contain the number 101 with a leading and trailing space. Put it all together, and you get a match for any line containing Gi7/, followed by 29 or 30-39. The “3” could be translated “3 followed by any of the digits 0 through 9 inclusive”. You get the “Gi7/”, right? No regex magic there. Show interf status | i Gi7/(29|3) ! Shows you the status of all ports in slot 7, 29 – 39 inclusive. If you want to match a random number of additional wildcard characters, follow the dot with an asterisk. The dot is a wildcard, allowing for any single character in that position. 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”. Show interf status | i Gi./2_ ! Shows you the status of all ports ending in 2. Here, tells the parser that values 2, 4, or 6 are all matches for that position. Show interf status | i Gi/20 ! Shows you the status of all port 20s in slots 2, 4, and 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/20 ! Shows you the status of all port 20s in slots 2-6 of a chassis with gig cards. Useful if you’re doing clean up after decommissioning an interface where you didn’t run a dynamic routing protocol. Show run | i ip route.*Serial1/1 ! Shows you all static routes in your configuration pointing out Serial1/1, no matter what they are. 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 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. Useful for displaying IP addresses with their associated masks and interfaces. 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. Here’s a few show commands I put together that pipe to “include” or “exclude” and use regular expressions to give you just the output you’re looking for at the Cisco IOS CLI.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |