All other Cisco networking related discussions.
ZeroZeroFourteen
Ultimate Member
Posts:
596
Joined:
Wed Nov 11, 2009 12:25 am

Useful IOS Commands

Tue Dec 01, 2009 1:50 pm

http://blog.alwaysthenetwork.com/?p=208

After reading that blog post, I got to thinking about IOS commands I use day to day that are the most useful to me and make life easier in one way or another.

What are some other commands you all use that are very useful?

One of my favorites by far is

show proc cpu history

That commands gives you an ascii graph of the cpu utilization for the past 60 seconds, 60 minutes, and 72 hours.

Works on routers and switches.

UPDATE: As requested, I have posted most of the commands in the replies in the main thread. Some of the commands I did not post were ones which I could not test/use to provide an accurate description of what they were (all of them are in Steven King and Vitos post)

Code: Select all
show interface description

shows list of interfaces, their current state, and their description
Code: Select all
show ip bgp summary

shows summary of BGP neighbor status
Code: Select all
show run, then type /(text)

After you enter show run, typing the / will tell the IOS to search for the specified string that is typed after the /. For example:
Code: Select all
show run
/wccp

You will be taken to the first line with wccp in it.
Code: Select all
show run | redirect tftp://##.##.##.##/bob.cfg

Easy backup or kick reports to a tftp server
show standby brief

Code: Select all
show standby brief

shows router redundancy information (HSRP)
Code: Select all
show interface status | exclude disa

shows interface status and excludes interfaces in the disabled state
Code: Select all
show cdp neighbor detail | include Device | IP address

Shows cdp neighbor device id (name) and its IP address
Code: Select all
show ver | i uptime
SHO INT | I FastE|never

In combination, usefull for telling you what ports on a switch are not used but still patched in by matching when the last input/output with the uptime of the switch.
Code: Select all
traceroute mac ip <source ip> <destination ip>

Usefull for doing traces across a layer 2 network
Code: Select all
wr
reload in 10
< make changes >
reload cancel
wr

Gives you a ten minute window to make changes and if you lose
connectivity the device, it reloads in 10 minutes and reverts back
to the startup-config, just remember to save AFTER you cancel the reload
Code: Select all
verify (image location)

make sure your IOS is not corrupt before reloading and ending up in ROMMON.
Code: Select all
show proc cpu sort | excl 0.00%__0.00%__0.00%

shows only active CPU procs
more system:run

ASA command, Shows your running config with more details. For example when you need to see the pre-shared key between a site-to-site VPN.
show interface status

shows current interfaces with current status (connected/not connected), vlan of each interface, duplex and speed.
Code: Select all
show interface stats

displays how much traffic goes across an interface, as well as how much of that traffic is process switched or cache switched.
Code: Select all
show vlan brief

Gives you what vlans are on switch and what ports on the switch are in those vlans without the extra "fluff" of show vlan.
Fluff being the extra chart at the bottom of a show vlan that show MTU, parentID, etc..
Code: Select all
sh cry isa sa

Active security associations, also known as tunnels
Code: Select all
sh cry ipsec sa

Shows encryption statistics detailed by access list entry for each tunnel
Code: Select all
sh cry isa policy

Shows phase 1 and 2 settings for tunnels
Code: Select all
clear cry isa sa

Shuts down a tunnel and waits for re-negotiation of phase 1
Code: Select all
show users

Shows users logged into vty lines
Code: Select all
clear line vty line #

And once you know the line of the person you don't want on your router.
Code: Select all
term no mon

Disable terminal monitoring
Last edited by ZeroZeroFourteen on Mon Feb 08, 2010 6:47 pm, edited 8 times in total.

User avatar
Vito_Corleone
Moderator
Posts:
9850
Joined:
Mon Apr 07, 2008 10:38 am
Certs:
CCNP RS, CCNP DC, CCDP, CCIP

Re: Useful IOS Commands

Tue Dec 01, 2009 2:02 pm

Free advertising! :lol:

I'll post my favorites. I use a lot of aliases, so I'll post those:

Code: Select all
alias exec traffic sh ip nbar protocol-discovery stats bit-rate top-n 10
alias exec s sh ip int b
alias exec sir show ip route
alias exec sion show ip ospf neighbor
alias exec svb show vlan brief
alias exec sr show run
alias exec sal show access-lists
alias exec srm sh route-map
alias exec proc show proc cpu sort | excl 0.00%__0.00%__0.00%
alias exec salsec sh ip access-list | sec
alias exec spmo show policy-map int fa0/0 out
alias exec spmi show policy-map int fa0/0 in
alias exec sift sh ip flow top


Most of the time I forget the alias so I just type the command out though, lol.
http://blog.alwaysthenetwork.com

User avatar
Chinese Buffet
Member
Posts:
128
Joined:
Fri May 02, 2008 11:06 pm

Re: Useful IOS Commands

Tue Dec 01, 2009 2:25 pm

My favourites...

sh int des
sh ip b s


CB

User avatar
dlots
Post Whore
Posts:
3508
Joined:
Mon Jun 15, 2009 9:48 am
Certs:
CC\NP\DP\IP\NP-Security\NA-Voice

Re: Useful IOS Commands

Tue Dec 01, 2009 3:00 pm

Most of the ones I use are CCNA type stuff, the one I did find that not many know about is the

/

you can use it to filter though till you get to a line with the info in it

Ex
show run
/wccp

will do a show of the running config
the /wccp will take you to the 1st line with wccp in it




Easy backup or kick reports to a tftp server
show run | redirect tftp://##.##.##.##/bob.cfg
Freedom to all the people. Brave, true and strong.
Freedom to all the people. Unless I think you're wrong

dhimes.com

User avatar
Vito_Corleone
Moderator
Posts:
9850
Joined:
Mon Apr 07, 2008 10:38 am
Certs:
CCNP RS, CCNP DC, CCDP, CCIP

Re: Useful IOS Commands

Tue Dec 01, 2009 3:03 pm

dlots wrote:Most of the ones I use are CCNA type stuff, the one I did find that not many know about is the

/

you can use it to filter though till you get to a line with the info in it

Ex
show run
/wccp

will do a show of the running config
the /wccp will take you to the 1st line with wccp in it


I didn't know about that! They stole it from VI. Awesome!
http://blog.alwaysthenetwork.com

User avatar
Chinese Buffet
Member
Posts:
128
Joined:
Fri May 02, 2008 11:06 pm

Re: Useful IOS Commands

Tue Dec 01, 2009 4:08 pm

dlots wrote:Most of the ones I use are CCNA type stuff, the one I did find that not many know about is the
Ex
show run
/wccp

will do a show of the running config
the /wccp will take you to the 1st line with wccp in it


That is 1337.


*** I just used this command for the very first time a min ago in a job I was doing :) Its going to be my in my fav. list pretty soon!
Last edited by Chinese Buffet on Tue Dec 01, 2009 5:07 pm, edited 1 time in total.

User avatar
lowjab
Member
Posts:
223
Joined:
Mon Jan 05, 2009 4:56 am
Certs:
CCNP

Re: Useful IOS Commands

Tue Dec 01, 2009 4:44 pm

Chinese Buffet wrote:sh int des

Nice, that one's going into my standard. I use "sh int status" a lot, but that truncates the description. I use these on all switches (also basic stuff)

Code: Select all
alias exec ss show standby brief
alias exec si sh int status | ex disa
alias exec sip sh ip int bri | ex una


And a nice one where cdp is used

Code: Select all
alias exec cdpnei sh cdp nei det | inc Device | IP address

User avatar
vstrabello
Member
Posts:
151
Joined:
Mon Nov 23, 2009 7:15 pm
Certs:
CCNA Certified! | Get a life!

Re: Useful IOS Commands

Tue Dec 01, 2009 5:17 pm

I just use q (as in quit) and then enter when I need to log out a device.

Also, I like to use the shortcuts in IOS...

http://www.cisco.com/en/US/docs/ios/12_ ... #wp1001693

noop
New Member
Posts:
5
Joined:
Sat Oct 24, 2009 10:31 pm
Certs:
A+

Re: Useful IOS Commands

Tue Dec 01, 2009 7:41 pm

here is my favorite cisco command:

?
(space ?)

Once you know that command, you know them all :)
noop

ZeroZeroFourteen
Ultimate Member
Posts:
596
Joined:
Wed Nov 11, 2009 12:25 am

Re: Useful IOS Commands

Tue Dec 01, 2009 7:59 pm

lowjab wrote:
Chinese Buffet wrote:sh int des

Nice, that one's going into my standard. I use "sh int status" a lot, but that truncates the description. I use these on all switches (also basic stuff)

Code: Select all
alias exec ss show standby brief
alias exec si sh int status | ex disa
alias exec sip sh ip int bri | ex una


And a nice one where cdp is used

Code: Select all
alias exec cdpnei sh cdp nei det | inc Device | IP address



That CDP Command is really nifty! I like the show int status as well.

User avatar
Leosv
Ultimate Member
Posts:
720
Joined:
Tue Jul 08, 2008 9:17 pm
Certs:
C_NA

Re: Useful IOS Commands

Tue Dec 01, 2009 10:31 pm

excellent thread!
" Those that know how to win are much more numerous than those who know how to make proper use of their victories."

Polybius

User avatar
mellowd
CCIE #38070
Posts:
13814
Joined:
Wed Jun 18, 2008 7:49 am
Certs:
CCIE (RS,SP), JNCIE-SP, BC-/SPNE/NP

Re: Useful IOS Commands

Wed Dec 02, 2009 2:37 am

Personally I don't use aliases because of the sheer amount of routers we log into. Also as the entire NOC and a few others need to log in, we would all want different aliases.

Therefore I'm just used to typing them out, as least not fully.

'do' is one of my most used commands. Saves a lot of time

User avatar
eaadams
Post Whore
Posts:
2611
Joined:
Fri Mar 11, 2005 10:26 pm

Re: Useful IOS Commands

Wed Dec 02, 2009 6:40 am

wr is quite handy.

Aubrey
The illiterate of the 21st century will not be those who cannot read and write, but those who cannot learn, unlearn, and relearn. Alvin Toffler, "Future Shock" 1970

User avatar
dlots
Post Whore
Posts:
3508
Joined:
Mon Jun 15, 2009 9:48 am
Certs:
CC\NP\DP\IP\NP-Security\NA-Voice

Re: Useful IOS Commands

Wed Dec 02, 2009 11:12 am

eaadams wrote:wr is quite handy.



Yeah I like it... but Cisco doesn't. On my CCNA I blew one of the sim questions because I did a copy start run and realized it right after I hit the next button :-(
Freedom to all the people. Brave, true and strong.
Freedom to all the people. Unless I think you're wrong

dhimes.com

User avatar
kannies
Post Whore
Posts:
1210
Joined:
Thu Jan 10, 2008 7:43 am

Re: Useful IOS Commands

Wed Dec 02, 2009 11:35 am

Code: Select all
show ver | i uptime
SHO INT | I FastE|never

In combination, usefull for telling you what ports on a switch are not used but still patched in by matching when the last input/output with the uptime of the switch.

User avatar
kannies
Post Whore
Posts:
1210
Joined:
Thu Jan 10, 2008 7:43 am

Re: Useful IOS Commands

Wed Dec 02, 2009 11:47 am

Another one I like (actually picked up from this forum!):

Code: Select all
traceroute mac ip <source ip> <destination ip>


Usefull for doing traces across a layer 2 network

User avatar
Vito_Corleone
Moderator
Posts:
9850
Joined:
Mon Apr 07, 2008 10:38 am
Certs:
CCNP RS, CCNP DC, CCDP, CCIP

Re: Useful IOS Commands

Wed Dec 02, 2009 12:39 pm

kannies wrote:Another one I like (actually picked up from this forum!):

Code: Select all
traceroute mac ip <source ip> <destination ip>


Usefull for doing traces across a layer 2 network


Yea, I've been using this one lately as well. It's pretty cool.
http://blog.alwaysthenetwork.com

Fred
Post Whore
Posts:
2566
Joined:
Sat Jun 07, 2008 11:06 am
Certs:
CCNP, CCDP

Re: Useful IOS Commands

Wed Dec 02, 2009 9:57 pm

dlots wrote:On my CCNA I blew one of the sim questions because I did a copy start run and realized it right after I hit the next button

Two things: First, you don't need to save your configuration on the labs. You can. It doesn't hurt anything, but it doesn't affect your score.

However, if you copy the startup config to the running config, that will hurt your score greatly. :)

User avatar
dlots
Post Whore
Posts:
3508
Joined:
Mon Jun 15, 2009 9:48 am
Certs:
CC\NP\DP\IP\NP-Security\NA-Voice

Re: Useful IOS Commands

Thu Dec 03, 2009 10:20 am

save your config was part of the question... and yes... yes it did
Freedom to all the people. Brave, true and strong.
Freedom to all the people. Unless I think you're wrong

dhimes.com

User avatar
ristau5741
Post Whore
Posts:
10488
Joined:
Tue Aug 21, 2007 2:15 pm
Certs:
Instanity

Re: Useful IOS Commands

Thu Dec 03, 2009 10:39 am

reload command, is one I like, when messing with remote gear

wr
reload in 10

< make changes >


reload cancel
wr


gives you a ten minute window to make changes and if you loose
connectivity the device, it reloads in 10 minutes and reverts back
to the startup-config, just remember to save AFTER you cancel the reload

'
Next

Return to Cisco General

Who is online

Users browsing this forum: No registered users and 23 guests