Monday, April 30, 2007

do - Executing Commands in Configuration Mode

Ever need to execute a command when you have already dropped into the configuration mode? I used to spend alot of time dropping out of config mode to either look at an interface configuration or verify that a command I had just entered actually affected my device as I had expected before moving on to more configuration tasks. As of IOS 12.2(8)T Cisco added a new command called do. This allows you to run an EXEC level command in configuration mode. Simple, just run do show run int fa0/0 and you'll get the output without having to go into EXEC mode. A quick example:


Router#
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#sh run int fa0/0
^
% Invalid input detected at '^' marker.

Router(config)#do sh run int fa0/0
Building configuration...

Current configuration : 133 bytes
!
interface FastEthernet0/0
description 3mb Internet Connection
ip address 172.16.1.60 255.255.255.248
speed 100
full-duplex
end

Router(config)#


A brief overview of the command can be found here:

http://www.cisco.com/univercd/cc/td/doc/product/software/ios124/124tcr/tcf_r/cf_02ht.htm#wp1035222

No comments: