- How well do you know the Cisco IOS?
Hopefully, in this video,
I'm gonna teach you some commands that you don't know.
♪ 'Cause we both deserved it all ♪
(techno pop music)
- In this video, I'm gonna show you some tips and tricks
with regards to the Cisco IOS.
Hopefully, this will make you
a better Cisco network engineer.
A lot of these commands are available
in the Configurations Fundamentals Configuration Guide.
Cisco had multiple examples of this guide
that show you, for instance,
the basics, like context-sensitive help,
CLI editing shortcuts and features,
but I'm gonna show you some more advanced stuff.
Please, comment below this video
and let me know at which point
in the video you learned something.
So let's see how far you can get through this video
without learning something new.
I'm running a GNS3 typology here,
there are two routers and a switch.
These are traditional Cisco routers
as in they run traditional, classic Cisco IOS.
Show Version shows me that the version of operating system
that this router is using is 15.6 2T.
So, classic, traditional Cisco IOS,
nothing spectacular or exceptional about the Cisco IOS.
These are Cisco viral images that I'm running within GNS3.
Okay, so let's start with something straight away.
show question mark.
Now, show here shows me a whole bunch of commands,
and I can scroll, and scroll, and scroll,
but notice, show question mark, I see more as an option.
So I've simply typed, show question mark.
When more is displayed,
I can use multiple options like forward slash.
This allows me to filter,
for instance for a keyword such as class.
So that's what I've typed.
IOS is filtering the output
of this show command to class-map.
More is displayed once again.
I can use forward slash.
And for instance, search for rad as in radius.
So all I did was type show question mark,
and notice the output is being filtered.
Forward slash again, the VPN.
Output is filtered to webvpn.
Now, you can use this with many commands such as show run.
So when I type show run, more is displayed,
forward slash, type something such as face.
The output is filtered until face is found,
as in interface Loopback100.
More is displayed.
Forward slash, let's look for something such as network.
This is filtering the output
until the first network statement.
Now, I've purposely used a sub-command here
rather than something such as router.
So as an example, I could filter for vty.
Now, some people have said
when I've shown them this previously,
that you could just type show run, pipe, section,
and let's say router slash vty as an example,
and that will show you the router configuration
and the vty configuration, and that's true.
I'm not trying to tell you
which command is better than another.
I'm trying to show you different options.
This shows me the router sections as in router eigrp,
router bgp, router ospf, and here I've got vty,
but notice when I type show run,
I could, as an example,
filter the config for one keyword such as face.
So that's a section of configuration
but then I could filter for a different keyword
which could be a sub-command, such as 0.0.
So that's filtering to that
which is actually a regular expression.
So let's do forward slash again
and say zero backslash dot zero.
So this is a regular expression saying
escape the spatial meaning of a dot.
A dot is any single character, so that matched to there.
But here, I'm gonna actually look for 0.0
and that's filtered down to here.
So it's not a section of code, it's a sub-command.
And then I can filter for something else, let's say login.
This is showing me the configuration from a certain point
in this example, banner login.
But what you might have noticed
is I've used four different search criteria
in one show command.
So I'm looking at output
and I'm doing multiple searches on that output.
The closest that you can get is perhaps begin.
So, show run, pipe, begin, and let's say login.
That will show me the running configuration
from the word login, as in banner login,
but that's all it's gonna give me.
But note, I have more here.
So I could do a search for vty or some other keyword.
It's not showing anything here
because vty was already displayed
and there's no vty in the remaining config.
But what I could do is type show run, pipe, begin, face,
something further up in the configuration, as in interface,
and then I could search for router,
and then search for something else, vty.
So, the forward slash command is fantastic.
It doesn't just work with show run,
it basically works with any command
where you've got more displayed.
So here, I've typed show ip route, more is displayed,
so what I can do is use forward slash,
and let's search for 172.
The show ip route output is filtered to 172,
and then I could filter for something else.
Let's say 192.168.105.
Output is filtered to that point in the ip route command.
So forward slash, really useful.
Another one that you could use,
note please, I'm gonna just do show question mark here.
Now, I'm gonna use plus and let's search for rou.
This is filtering all that output
to only show me show commands with rou in them.
Now, you might say, well, David, this is kinda pointless,
but don't restrict your imagination.
Look at what this command can do
and then play around with different options
and see what works for you.
The moral of the story is with a command showing more,
you could either use forward slash or you could use plus,
and another option is minus
where I don't wanna see certain commands.
I wanna remove everything let's say with rou in it.
Now, that's not a great example,
so let's do that with a routing command like show ip route.
So show ip route, I don't wanna see, let's say, 192 routes.
The routing table here has been filtered to remove 192.
Now, let me just show you
the whole routing table to make the point.
Show ip route, no filtering.
We've got two routes, we've got 10 routes,
we've got 172 routes, we've got 192 routes
in the routing table here.
But if I type show ip route,
I could say minus, don't show me 172, don't show me 192.
I don't wanna see those routes
in the output of this command.
Now, again, you could type show ip route, pipe, include,
or let's do exclude, which is similar to minus, 172, 192.
You could do it that way
and that will show you equivalent output.
In this method, you are doing the command
before showing the output.
In the other method, I'm typing a command,
when I see more, then I'm deciding what to exclude,
and I can do that multiple times with a backslash
but I can't do that with a minus or plus.
But with a backslash, I could filter multiple times.
Okay, so show, run, pipe.
Begin is similar to forward slash,
include is similar to plus, exclude is similar to minus.
Okay, so that's some basic commands.
Plus, minus, forward slash.
You, once again, can do that with any command,
so I'll show you one more example and then wrap it up.
Here in bgp, I've can use question mark.
Bgp question mark gives me the options.
I could say bgp question mark plus max.
This only shows me commands with the max keyword in them.
I filtered the output.
And again, wherever you are, and you use question mark,
and I shouldn't be using show there.
Let me just use question mark
in global config mode with no options.
Wherever you are here,
you can use forward slash, plus, minus.
So rou, as an example here,
shows me all commands in global config mode
that have rou in them
either as the command or as the description of the command.
So if you can just slightly remember
what a command should give you,
but you can't remember the exact command,
you can filter that way if you want to.
Okay, but let's step it up a notch.
Let's enable a Linux command directly on the Cisco IOS.
Now, I've discussed this command,
shell processing full, in this video.
If you wanna see more details, have a look at this playlist.
You can either enable this globally
or you can just enable it on the current terminal.
But what this allows me to do
is it allows me to use Linux commands such as cat.
So, show shell functions shows me options,
grep is a great one, which I'm gonna show you right now.
We've also got interface which I'll show you in a moment.
We've also got nl, which numbers any line in the output.
Basically, there's a whole bunch of things we can do now
that you can't typically do with Cisco IOS.
So, include, exclude, commands like that are very limited.
Here, we can do nested greps,
all kinds of interesting things.
So as an example, show ip interface brief
gives me a list of interfaces on this router.
So there's the command again, show ip interface brief,
bunch of output on the router.
So, I'll just do that again.
There's the command.
Here are all the interfaces.
But what I could do now is say grep
and only show me interfaces that are up.
So, all those interfaces are up.
This command shows me all up interfaces.
Scrolling up to the previous command,
show ip interface brief shows me interfaces
but also shows me interfaces that are down.
So these interfaces are currently down.
But I can do nested greps now.
Remove loopbacks from that output.
So show me all interfaces that are up
but remove loopback interfaces.
Now, you could perhaps just do it this way,
show me all interfaces except loopback interfaces.
But notice those interfaces are administratively down.
Again, use your imagination.
This is a positive match.
This is an exclusion,
so we're basically doing an include and then an exclude.
Now, let me show you some more commands
that I haven't discussed in other videos.
How about this?
Show me the running configuration but begin with 0/0.
This is similar to begin,
but I'm going to make it more complex in a moment,
and let me push that to more because this is like Linux,
so you can use more to show one page at a time.
So that command that I ran there
shows the running configuration from this point,
but it's showing the entire running configuration,
and it went by very quickly.
If I push it to more, it's gonna show me one page at a time.
So there's the command showing one page of output at a time.
But you could say, well, I could just do that with begin.
Okay, but how about this?
Show me the running configuration
beginning at this point, but ending at router.
So in other words, scrolling up,
we're gonna start at this point,
but only show me until this point.
When we see router, stop the output.
Okay, so let's try that.
Show run, pipe, grep, begin, 0/0, grep u router.
There's the output, interface Gigabit 0/0,
and notice it ended at the point specified, ended at router.
Now, again, if you don't wanna just scroll past,
if you got a lot of output, you can use more,
so we're doing double greps here and pushing it to more
to only show certain parts of the configuration.
But you could say, David, I could just use section,
like section interface.
But notice the difference.
With section interface, I am seeing the loopback interfaces,
and then I'm seeing my gigabit interfaces.
What I'm doing with grep here
is I'm deciding which section of code I wanna see.
Could be a small piece of code,
could be a long piece of code,
and I'm not restricted by what I can search on.
I could, for instance, search on a exclamation,
so show me the output from 0/0 until exclamation.
Basically, you search on anything you want.
Okay, so there you go, that did it.
Didn't do it previously.
Notice it started at Gigabit 0/0, ended at exclamation y,
because when you do show run,
I'll use my forward slash again, I like forward slash,
I showed the config from this point until this point.
You basically have the power here to do what you want,
to search for whichever output you want.
So let's do it from grep 'til login.
I wanna see all the output from 0/0 until login.
So, all the output from 0/0, so zero slash zero,
interface Gigabit 0/0 until login.
So I'll see my interfaces, I see router,
and when I see login, it ends.
So actually, I should have done control-plane there.
So let's do plane because I don't wanna get the banner.
So show me all the configuration from 0/0 until plane,
so there's interface Gigabit 0/0
scrolling all the way down until plane.
The plane, control plane command,
is too big to be shown here in the output.
I don't wanna see that.
I just wanna see up 'til that point.
Okay, but grep is even more powerful.
How about this?
Typically, commands are case-sensitive,
but I could say i.
So Face, I'm gonna put in uppercase.
Notice, please, that face here is lowercase,
but I'm gonna say ignore case.
When you use section or include or one of those commands,
it's case-sensitive.
So commands such as show run, pipe, include, exclude,
are case-sensitive, but here, I've told it,
show me the running configuration from face,
face being uppercase or lowercase, don't care, until plane.
So I'm seeing all my loopback interfaces
and then I'm seeing gigabit interfaces up 'til plane.
Now, if you're not sure about options, notice man,
which is a Linux command for manual, grep shows me options.
So there's b, match everything in a file after pattern,
dash i or hyphen i, ignore case,
u, match everything until a certain pattern, v is invert.
So typically, when you do show run, pipe, include,
you have to match the case here.
But with grep, you don't have to.
So show run, pipe, include, face,
this matches all lines with the word face in it.
I could say grep i
and then my face can be any case I want.
Doesn't matter what the case is here.
That wouldn't work with include.
So output is the same,
but let's say I wanna exclude my loopbacks.
So let's use a negative grep.
So, v says exclude LoopBack interfaces.
So I'll use -v Loop.
So show me the ethernet interfaces,
but exclude the loopback interfaces.
And there you go, I'm only seeing gigabit interfaces.
So that's a really powerful option.
Now, this video is unfortunately getting quite long
so I'm gonna have to put the more advanced stuff
that I wanted to show you in a separate video,
but hopefully you've found this useful.
Again, please comment below
and let me know what you've learned.
At what timestamp did you actually learn something?
Which commands did you learn?
And, as always, please,
would you subscribe to my YouTube channel?
Please, would you like this video if you found it useful?
Please click on the bell to give notifications
when I post a new video.
♪ 'Cause we both deserved it all ♪
(techno pop music)