Cisco IOS output filters allow network administrators to narrow down the results of verbose show commands using pipe operators with keywords like begin, include, exclude, and section.
IOS Show Command Filters
We took a look at some of those show commands, but those show commands can give us a lot of output sometimes. For instance, that show running-config, even on a simpler switch, can be fairly extensive. So we're going to start using some filters to narrow down to the information that you're really looking for.
I have a switch here, and I'm just going to type in show running-config and hit enter on that, and then it's going to list out the full running config file. I'm going to just hit spacebar every time I see "more" to scroll through this.
I do want to point out that on 014 I added a description, so we could see how some of these commands that I'm about to go over interplay with this. Just know that the description "demo laptop" is under 0 14. Then I'm going to go through the rest of these, and there we get to the end of the running config.
What I'm going to do is actually pipe this into a filter command, so I'm going to use the pipe to do this. I add the pipe and then I'm going to use the question mark, and you can see there's a lot of ways I can filter this out: I can append, I can begin, count, exclude, format, include. The ones we're actually going to go over today are four: the begin, the include, the exclude, and the section. Let's take a look at those four and see what they look like.
First of all I'm going to do the begin. Let's say I want to just see from the fast ethernet connections and beyond within the running config file. So I'm going to say begin, and I'm going to say interface FastEthernet. Notice that it's case sensitive, so I had to use the capital F and capital E in FastEthernet.
I'm going to hit enter, and now what it's doing is sorting through the running config file, and then, once it found the interface FastEthernet, it started listing everything after that — including those things that aren't even fast ethernet, so it's showing me the end of the file as well. So it begins at a certain point and shows you all of the rest of it.
The next one that we'll take a look at is the include. I'm going to do the include here and hit enter, and now what it's looking for is any line that includes interface FastEthernet, and then it will include that. So it's including all of my interfaces in there, no details of those interfaces. Notice when we look at the FastEthernet 014 there's no description in it.
And then it's not going to list the end of the file either, because the end of this running config doesn't have interface FastEthernet in it. So it just includes up to the last interface FastEthernet, and then that's it.
Now let's take a look at exclude. I'm going to change this to exclude and — if you guessed it right — now what's happening is it's looking through and it's going to list out everything unless it has interface FastEthernet in it. It's even to the point that it didn't include the interface FastEthernet 014, but it did include the description of that interface. And then we cycle through to the end here.
Finally, we're going to do a section, and that's going to show certain sections. When I do section interface FastEthernet, then it's going to show any of the sections that include interface FastEthernet. So now it's showing us all of the fast ethernet interfaces, including the programming that's associated with it. So the description "demo laptop" is associated with 0 14, so it's showing that as well. And then we get to the end here, and it doesn't show the end of the file.
So that is begin, include, exclude and section. Those are just a few — we saw a few more in there as well — that we can use to filter out our show commands, or what's displaying on our screen, so we can get to the exact information that we want to get to and be able to pull that information very efficiently.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →