This is a continuation of a series of videos where I'm teaching you to become a better network engineer
and teaching you commands and the Cisco IOW that you may not have known about
please do me a favor put a comment below this video and let me know when you've learnt something.
So put a timestamp on the video.
So how far did you get through the video before you learned something.
Which command did you learn.
If you've no commands that I haven't used.
Options that I haven't used please add them below this video so that we can all learn from one another.
I wish I knew everything but I don't.
I'm just sharing some tips and tricks that I know but please also add your tips and tricks below this
video because this is YouTube.
Please would you subscribe to my YouTube channel please would you like this video.
If you find it useful and please click on the bell to get notifications when I post a new video in this
video I'm going to show you some Linux commands that you can run on Cisco IOW that will hopefully save
you a lot of time and hopefully surprise you with what's possible on the Cisco IOW in this example.
I'm running a Cisco router.
This is a traditional Cisco.
IOW in other words classic Cisco Iowa's version 15 6 2 t.
This is a viral image that's running within Gen S3.
So on this writer what I'm going to do is enable show processing full.
This allows me to run Linux commands directly on the Cisco IOW I could also just do it this way If I
only want to run it for my current terminal and not enable it globally on the router.
Have a look at the series of videos.
If you are not sure about what this command does.
I've discussed it in previous videos so I won't go through all the options here.
Now Shell processing supports quite a few commands.
If I type show shell functions I can see that catch is supported as an example grep is supported.
But note this option.
Interface print interfaces that match the argument.
I'm gonna run a very basic scripture which is for X X in interface Ethernet 0.
Do echo done.
This is a very basic script paste that directly into privilege mode.
Notice I see the interfaces on the router similar to show IP interface brief but I'm only looking at
ethernet interfaces so again that's the script that I ran.
I'll post all these scripts below this video so don't worry trying to copy this down.
Just get it from below this video that's showing me the interfaces on the router now.
That may not be that interesting.
So let's expand the script.
I'm going to say 4 x x in interface Ethernet do echo echo is one of the shell functions available notice
over there.
Echo arguments to the terminal so I'm gonna basically echo something to the terminal based on show interface
include input errors.
So this is going to show me not just the interfaces but it's also going to show me any input errors.
So this line input error CRC frame overrun ignored is displayed in the output C may preferred doing
that on a switch.
So here's my switch terminals shell to enable the shell
paste thudding I see all the interfaces on the switch and now I can see input errors CRC overruns etc..
So I'll be able to see any errors on an interface by simply running a very basic to line script if you
like.
If you want more details this is available in the Cisco Iowa's shell configuration guide.
Again I've covered some of this in separate videos where I talk about terminal shell vs. enabling this
globally on a device.
But if you scroll down they start talking about scripts that you can run.
So very basic script is echo here is a string with X Y Z in it where x y z is a variable in my basic
script.
This is my variable X X so that's used in multiple places
scrolling down a bit further.
We can use if statements we can use for loops.
So let's take a very basic for loop here directly from the documentation on my switch.
I'll paste that in for x in 1 2 3 4 5 echo X so just print that out.
That's what we get.
One two three four five.
Not very interesting but let's do something with this by using a loop with a break statement so I'll
copy this exactly as it is and I'll paste that into a switch and we get numbers 1 2 3 up to 10.
Again not that interesting but what I've done is I've taken this exact script and then I've enhanced
it slightly to do something useful.
So here's my script I've created a function which means that it's a command that I can run multiple
times rather than just pasting something into the CLIA.
So at the moment on the switch if I type show run.
That doesn't work it's actually trying to do a domain lookup here on that.
So I'll speed up the video to break that.
Notice it's doing translating show runs so comp.
No IP domain lookup
var top should run that command doesn't work.
It's trying to do domain look up on that obviously show run like that to will do something to show space
run but S H R UN is not a valid command but what I can do is paste my script in so I've created this
function called show run literally pasting that script in that I've created now if I type show run it's
doing a whole bunch of stuff and actually let me edit that down.
What I've done here is create this function setting end minus 1.
And while something is true do something n is equal to itself plus 1.
So while end is less than or equal to three type show run interface gigabit 0 something I'll get rid
of the show IP right because that just confuses the output.
So paste that back in again show run what this command has done is it's running a show run interface
on specific interfaces.
Notice gigabit 00 gigabit 0 1 gigabit to 0 2 and gigabit.
0 3.
It's also printing out this number which came from our script that echo.
Let's get rid of that.
So I'm basically creating a function here that does a show run of interfaces on the switch.
So show run first interface 0 0 is then 0 1 0 2 0 3 and so forth.
So it's doing a show run on each interface but you could type any command here.
I've just done show run interface gigabit zero and then a number I could do show interface like that.
So rather than show run do a show interface on individual interfaces so type that again show run.
There's the first interface there's the second interface third interface fourth interface and done now
there are more interfaces than that on the switch.
A whole bunch of interfaces are available in the switch but what I wanted to show you is that you can
run linux scripts directly on the Cisco IOW by simply enabling shell processing food either globally
on the switch or just typing terminal shell
this document on Cisco's website which I'll link below gives you more examples where you can do like
logical tests if this equals this.
Then echo something there's a whole bunch of options that you can do.
This is actually one of the commands I've just shown you.
You can actually configured interfaces if you want to as an example set the interface description to
something.
Okay I do want to turn this into a programming video because it'll get too long.
I just wanted to show you some basic scripts that you may find useful like this showing all interface
errors and then you can do basic or more complex scripting.
Okay so I hope you found this video useful.
I hope you've learned something.
I'll continue creating additional videos showing you options in the Cisco IOW that perhaps you don't
know about that can make you a better network engineer.
Once again if you don't mind please subscribe to my YouTube channel.
Please like this video and please click on the ballot to get notifications.
I'm David bumble.
I want to wish you all the very best.