Phase 2 - Understanding the Cisco IOS Command Line Interface (CLI)

This section provides information about the basic Cisco IOS commands that you need to configure your router. If you are familiar with the Cisco IOS command line interface (CLI), skip this section. Summary of Main Cisco IOS Command Modes

The following table provides a summary of the main command modes that are used in the Cisco IOS CLI. For a complete list of configuration modes, see “Cisco IOS Command Modes,” which is available here: Click here

Summary of the Main Cisco IOS Command Modes

Command Mode Access Method Prompt Exit Method
User EXEC Log in. Router> Use the logout command.
Privileged EXEC From user EXEC mode, use the enable EXEC command. Router# To exit to user EXEC mode, use the disable command. To enter global configuration mode, use the configure terminal privileged EXEC command.
Global configuration From privileged EXEC mode, use the configure terminal privileged EXEC command. Router(config)# To exit to privileged EXEC mode, use the end command or press Ctrl-Z. To enter interface configuration mode, use the interface configuration command.
Interface configuration From global configuration mode, enter by specifying an interface with an interface command. Router(config-if)# To exit to global configuration mode, use the exit command. To exit to privileged EXEC mode, use the end command or press Ctrl-Z. To enter subinterface configuration mode, specify a subinterface with the interface command.

Getting Context-Sensitive Help

Entering a question mark (?) at the system prompt displays a list of commands that are available for each command mode. You also can get a list of the arguments and keywords available for any command by using the context-sensitive help feature.

To get help specific to a command mode, a command name, a keyword, or an argument, use any of the commands that the following table describes:

Command Purpose
(prompt)# help Displays a brief description of the help system.
(prompt)# abbreviated-command-entry? Lists commands in the current mode that begin with a particular character string.
(prompt)# abbreviated-command-entry Completes a partial command name.
(prompt)# ? Lists all commands available in the command mode.
(prompt)# command ? Lists the available syntax options (arguments and keywords) for the command.
(prompt)# command keyword ? Lists the next available syntax option for the command.

Note that the system prompt varies depending on which configuration mode you are in.

When using context-sensitive help, the space or lack of a space before the question mark (?) is significant. To obtain a list of commands that begin with a particular character sequence, type those characters followed immediately by the question mark (?). Do not include a space. This form of help is called word help, because it completes a word for you.

To list keywords or arguments, enter a question mark (?) in place of a keyword or argument. Include a space before the** ?**. This form of help is called *command syntax help, *because it shows you which keywords or arguments are available based on the command, keywords, and arguments you already have entered.

You can abbreviate commands and keywords to the number of characters that allow a unique abbreviation. For example, you can abbreviate the **configure terminal **command to config t. Because the abbreviated form of the command is unique, the router will accept the abbreviated form and execute the command.

Entering the** help** command (available in any command mode) provides the following description of the help system:

  Router# help
  Help may be requested at any point in a command by entering
  a question mark '?'. If nothing matches, the help list will
  be empty and you must back up until entering a '?' shows the
  available options.
  Two styles of help are provided:
  1. Full help is available when you are ready to enter a
  command argument (e.g. 'show ?') and describes each possible
  argument.
       
  2. Partial help is provided when an abbreviated argument is entered
  and you want to know what arguments match the input
  (e.g. 'show pr?'.)

As described in the help command output, you can use the question mark (?) to complete a partial command name (partial help), or to obtain a list of arguments or keywords that complete the current command.

The following example illustrates how the context-sensitive help feature enables you to create an access list from configuration mode.

Enter the letters co at the system prompt followed by a question mark (?). Do not leave a space between the last letter and the** **question mark. The system provides the commands that begin with co.

  Router# co?
  configure  connect  copy

Enter the configure command followed by a space and a** **question mark to list the keywords for the command and a brief explanation:

  Router# configure ?
  memory    Configure from NV memory
  network   Configure from a TFTP network host
  overwrite-network  Overwrite NV memory from TFTP network host
  terminal  Configure from the terminal
  <cr>

The symbol ("cr" stands for carriage return) appears in the list to indicate that one of your options is to press the Enter key to execute the command, without adding any additional keywords.

In this example, the output indicates that your options for the configure command are configure memory (configure from NVRAM), configure network (configure from a file on the network), configure overwrite-network (configure from a file on the network and replace the file in NVRAM), or configure terminal (configure manually from the terminal connection).

For most commands, the symbol indicates that you can execute the command with the syntax you have already entered.

However, the configure command is a special case, as the CLI prompts you for the missing syntax:

  Router# configure
  Configuring from terminal, memory, or network [terminal]? terminal
  Enter configuration commands, one per line.  End with CNTL/Z.
  Router(config)#

The default response for the ? prompt is indicated in the CLI output by a bracketed option at the end of the line. In the preceding example, pressing the Enter key is equivalent to typing the word "terminal."

To skip the prompting, enter the configure terminal command to enter global configuration mode:

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

The CLI provides error isolation in the form of an error indicator, which appears as a caret symbol (^).

The ^ symbol appears at the point in the command string where you entered incorrect or unrecognized command syntax.

For example, the caret symbol in the following output shows the letter that was mistyped in the command:

  Router# configure termiMal
                       ^	
  % Invalid input detected at '^' marker.
    
  Router#

Using the no and default Forms of Commands

Almost every configuration command has a no form. In general, use the no form to disable a feature or function. Use the command without the no keyword to reenable a disabled feature or to enable a feature that is disabled by default. For example, IP routing is enabled by default. To disable IP routing, use the no ip routing form of the ip routing command. To reenable it, use the plain ip routing form.

The Cisco IOS software command reference publications describe the function of the no form of the command whenever a no form is available.

Many CLI commands also have a** default** form. By issuing the command default command-name, you can configure the command to its default setting. The Cisco IOS software command reference publications describe the function of the default form of the command when the default form performs a different function than the plain and no forms of the command. To see what default commands are available on your system, enter default ? in the appropriate command mode.

For more detailed information, see “Using the Command Line Interface,” which is available here:

Click here