If you enter a wrong command …

When you have a Cisco router configured, you may make a mistake in setting it up. You may also want to delete the configuration because you no longer need the previous configuration and you want to delete the configuration. Configuration commands entered from a configuration mode, such as global configuration mode, are added to running-config. When you make a mistake, or when you no longer need the settings, you can delete the configuration commands from running-config.

To remove the command, enter it again with ‘no’.

To remove a configuration command from running-config, simply prefix the command you want to remove with “no”.

running-config is a text file in which each line is a configuration command. Configuration commands are commands you enter from the various configuration modes, starting with global configuration mode. When deleting a configuration command, you must know which configuration mode it is for.

Consider the following running-config excerpted configuration command.

Fig. running-config sample
Fig. running-config sample

The configuration commands on a line that is not indented on running-config are the global configuration mode commands. In the example above, “hostname Gene” is the global configuration mode configuration command.

The indented configuration commands are the configuration commands of the preceding configuration mode. In the above example, “ip address”, “shutdown”, “duplex auto”, and “speed auto” are indented. These are the configuration commands for the immediately preceding unindented line, “interface FastEthernet0/0”, that is, the FastEthernet0/0 interface configuration mode.

To remove a configuration command, go to the configuration mode where you should enter the command to be removed, and enter the command with a leading “no”. Then, the deleted command is divided into three cases in running-config.

  1. Replaced by the default configuration commands
  2. It remains on running-config with a leading “no”.
  3. disappears from running-config

From Fig. running-config sample, delete the three configuration commands: “hostname Gene”, “ip address”, and “shutdown”. hostname Gene” is for case 1, “ip address” is for case 2, and “shutdown” is for case 3.

Since “hostname Gene” is a global configuration mode command, type “no hostname Gene” in global configuration mode.

Gene#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Gene(config)#no hostname Gene

You can delete a command by simply typing “no hostname”. How much of the configuration parameters you need to enter when deleting a command is different for each command. It is hard to remember how many parameters you need to enter when deleting a command, so you can be sure to enter all the lines you want to delete with a “no”.

Since “ip address” and “shutdown” are the interface configuration mode commands for FastEthernet0/0, in FastEthernet0/0 interface configuration mode, enter a command with a prefix of no.

Router(config)#interface FastEthernet 0/0
Router(config-if)#no ip address
Router(config-if)#no shutdown

After removing the three commands, running-config looks like this.

Fig. running-config sample After deleting the command
Fig. running-config sample After deleting the command

You can also remove all the settings for a particular interface only and initialize the interface settings. For more information, see the following articles

Device Initialization

To remove all the configuration commands you entered and initialize your Cisco device’s configuration, simply delete the NVRAM startup-config and reboot the device; without the startupc-config, it will start with just the default configuration commands.

To remove startup-config and reboot, run the command in privileged EXEC mode as follows.

Router#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
Erase of nvram: complete
*Mar  3 16:48:11.287: %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram

System configuration has been modified. Save? [yes/no]:no
Proceed with reload? [confirm]

The “System configuration has been modified. Save?” message is “Do you want to save the configuration because it has been modified? If you select yes here, the running-config is copied into startup-config. If you select yes here, you can’t initialize the configuration because running-config is copied into startup-config.

And “Proceed with reload? [confirm]” is the final confirmation of the reboot. Press the [Enter] key to reboot.

If you start in the initial state without startup-config, you will see the following message.

         --- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]:

This message asks if you want to go into dialog-style configuration mode for initial setup. Dialog-style configuration mode is not often used. Type no to set up the usual commands.

Cisco Basic