Using the Command Line

This chapter describes the Command Line Interface (CLI) you use to configure platforms utilizing
Cisco IOS 15.2(4) GC. This chapter includes the following major sections:


Note Any Internet Protocol (IP) addresses used in this document are not intended to be actual addresses. Any examples, command display output, and figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses in illustrative content is unintentional and coincidental.



Note The examples in this chapter are not platform specific.


Accessing the CLI

You can access the Cisco IOS CLI through the Gigabit Ethernet 0/0 interface using Secure Shell (SSh) or Telnet to establish a Virtual TeletYpe (VTY) session with the router.

After accessing the CLI on the router, the screen displays the following message:

Press Return for Console prompt
 
Router> enable
Password:< >
Router#

Performing Command Line Processing

Commands are not case-sensitive. You can abbreviate commands and parameters if the abbreviations contain enough letters to be different from any other currently available commands or parameters.

You can scroll through the last 20 commands stored in the history buffer and enter or edit a command at the prompt. Table 2-1 lists the keyboard shortcuts for entering and editing commands.

 

Table 2-1 Keyboard Shortcuts

Keystrokes
Result

Press Ctrl-B or
press the Left Arrow key1

Moves the cursor back one character.

Press Ctrl-F or
press the Right Arrow key1

Moves the cursor forward one character.

Press Ctrl-A

Moves the cursor to the beginning of the command line.

Press Ctrl-E

Moves the cursor to the end of the command line.

Press Esc-B

Moves the cursor back one word.

Press Esc-F

Moves the cursor forward one word.

1.The Arrow keys function only on ANSI-compatible terminals, such as VT100s.

Performing History Substitution

The history buffer stores the last 20 command lines you entered. History substitution enables you to access these command lines without retyping them. Table 2-2 lists the history substitution commands.

 

Table 2-2 History Substitution Commands

Command
Purpose

Ctrl-P or the Up Arrow key2

Recalls commands in the history buffer, beginning with the most recent command. Repeat the key sequence to recall older commands successively.

Ctrl-N or the Down Arrow key1

Returns to more recent commands in the history buffer after commands have been recalled with Ctrl-P or the Up Arrow key. Repeat the key sequence to recall more recent commands.

Router# show history

Lists the last several commands you entered in EXEC mode.

2.The Arrow keys function only on ANSI-compatible terminals such as VT100s.

Understanding Cisco IOS Command Modes

The Cisco IOS user interface has many different modes: user EXEC, privileged EXEC (enable), global configuration, interface, subinterface, and protocol-specific modes. The commands available to you are dependent on your current command mode. To get a list of the commands in a given mode, enter a question mark (?) at the system prompt. See the Getting a List of Commands and Syntax section for more information.


Note For complete information about Cisco IOS command modes, see the Cisco IOS Configuration Fundamentals Configuration Guide and the Cisco IOS Configuration Fundamentals Command Reference at the following URL: http://www.cisco.com/en/US/partner/products/ps11746/prod_command_reference_list.html


Working with Frequently Used Command Modes

When you start a session, you begin in user mode, also called user EXEC mode. Only a small subset of commands are available in EXEC mode. To have access to all commands, you must enter privileged EXEC mode, also called enable mode. To access the privileged EXEC mode, you must enter a password. When you are in the privileged EXEC mode, you can enter any EXEC command or access global configuration mode. Most EXEC commands are one-time commands, such as show commands, which display the current configuration status, and clear commands, which reset counters or interfaces. The EXEC commands are not saved when the Cisco router is rebooted.

The configuration modes allow you to make changes to the running configuration. If you save the configuration, these commands are stored when you reboot the router. You must start in global configuration mode. From global configuration mode, you can enter interface configuration mode, subinterface configuration mode, and a variety of protocol-specific modes.

Table 2-3 lists and describes frequently used Cisco IOS modes.

 

Table 2-3 Frequently Used Cisco IOS Command Modes

Mode
What You Use It For
How to Access
Prompt

User EXEC

To connect to remote devices, change terminal settings on a temporary basis, perform basic tests, and display system information.

Log in.

Router>

Privileged EXEC (enable)

To set operating parameters. The privileged command set includes the commands in user EXEC mode, as well as the configure command. Use the configure command to access the other command modes.

From user EXEC mode, enter the enable command and the enable password (if a password has been configured).

Router#

Global configuration

To configure features that affect the system as a whole, such as the system time or router name.

From privileged EXEC mode, enter the configure terminal command.

Router(config)#

Interface configuration

To enable or modify the operation of a Gigabit Ethernet, Fast Ethernet, E1/T1, or smart serial interface with interface commands.

From global configuration mode, enter the interface type location command.

Router(config-if)#

The Cisco IOS command interpreter, called the EXEC, interprets and runs the commands you enter. You can abbreviate commands and keywords by entering just enough characters to make the command unique from other commands. For example, you can abbreviate the show command to sh and the configure terminal command to config t.

When you type exit, the router backs out one level. To exit configuration mode completely and return to privileged EXEC mode, press Ctrl-Z.

When you type end, the router returns to EXEC mode.

Using the “do” Command

EXEC-level commands, such as the show commands, are not listed on the same modes as the subcommand modes, such as SEU configuration. Use this command to execute EXEC commands (such as show, clear, and debug commands) while configuring your routing device. After the EXEC command is executed, the system will return to the configuration mode you were using.

To execute an EXEC-level command from global configuration mode or any configuration submode, use the do command in any configuration mode:

 

Command
Purpose

Router(config)# do command

Allows execution of an EXEC-level command from global configuration mode or any configuration submode.

Getting a List of Commands and Syntax

In any command mode, you can get a list of available commands by entering a question mark (?).

To obtain a list of commands that begin with a particular character sequence, enter those characters followed by the question mark (?). Do not include a space before the question mark. 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 question mark. This form of help is called command syntax help, because it reminds you which keywords or arguments are applicable based on the command, keywords, and arguments you have already entered.

Router# show cdp ?
entry Information for specific neighbor entry
interface CDP interface status and configuration
neighbors CDP neighbor entries
traffic CDP statistics
| Output modifiers
<cr>
 
Router#