In Cisco IOS, EXEC mode commands cannot be run from the Global Configuration mode or in any other configuration mode. This means, everytime an admin makes a change from the configuration mode (Global Config) then you have to "end" or "Ctrl+Z" back to the EXEC mode and run the EXEC commands like "show", "clear" and "debug" commands.With the "do" command thats a thing of the past. The "do" command can be used to run any EXEC commands from within Global Configuration mode or any other Configuration mode without having to end the config mode.
The usage is very simple as well. All you need to do is to add the keyword before the command that you would like to run.
Switch(Config-if)# do sh interface fa1/1
In the above, the "do" command allows running the "show interface" command from within the Interface configuration mode.
Following is an example to show the Serial Interface from Global Configuration mode:
MyRouter(config)# do show interfaces serial 3/0
Serial3/0 is up, line protocol is up
Hardware is M8T-RS232
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load 1/255
Encapsulation HDLC, loopback not set, keepalive set (10 sec)
Last input never, output 1d17h, output hang never
Last clearing of "show interface" counters never
The following command clears the interface counters from the global configuration mode:
MyRouter(config)# do clear counters FastEthernet 1/1
This is supported on most of the Cisco Catalyst Switches and Routers. For more information and official Cisco documentation, please click here