Chapter 7. The Command-Line Interface

This chapter provides information and commands concerning the following topics:

Shortcuts for Entering Commands

To enhance efficiency, Cisco IOS Software has some shortcuts for entering commands. Although these are great to use in the real world, when it comes time to take the CCNA 200-301 exam, make sure you know the full commands, not just the shortcuts.

Router> enable = Router> enab = Router> en Entering a shortened form of a command is sufficient as long as there is no confusion about which command you are attempting to enter
Router# configure terminal = Router# config t

Using the Image Key to Complete Commands

When you are entering a command, you can use the Image key to complete the command. Enter the first few characters of a command and press the Image key. If the characters are unique to the command, the rest of the command is entered in for you. This is helpful if you are unsure about the spelling of a command.

Router# sh Image = Router# show

Tip

If your keyboard does not have a Image key, press Image instead.

Console Error Messages

You may see three types of console error messages when working in the CLI:

  • Ambiguous command

  • Incomplete command

  • Invalid input

Error Message Meaning What to Do
% Ambiguous Command: “show con” Not enough characters were entered to allow device to recognize the command.

Reenter the command with a question mark (?) immediately after the last character:

show con?

All possible keywords will be displayed

% Incomplete Command More parameters need to be entered to complete the command. Reenter the command followed by a question mark (?). Include a space between the command and the question mark (?)
% Invalid input detected at ^ marker The command entered has an error. The ^ marks the location of the error. Reenter the command, correcting the error at the location of the ^. If you are unsure what the error is, reenter the command with a question mark (?) at the point of the error to display the commands or parameters available

Using the Question Mark for Help

The following output shows you how using the question mark can help you work through a command and all its parameters.

Router# ? Lists all commands available in the current command mode

Router# c?

calendar call-home cd clear clock cns configure connect copy crypto

Lists all the possible choices that start with the letter c

Router# cl?

clear clock

Lists all the possible choices that start with the letters cl

Router# clock

% Incomplete Command

Tells you that more parameters need to be entered

Router# clock ?

read-calendar

set

update-calendar

Shows all subcommands for this command
Router# clock set 19:50:00 14 July 2019 ? Image Pressing the Image key confirms the time and date configured
Router# No Error message/Incomplete command message means the command was entered successfully

enable Command

Router> enable Router# Moves the user from user mode to privileged EXEC mode. Notice the prompt changes from > to #

exit Command

Router# exit

or

Router> exit

Logs a user off

Router(config-if)# exit

Router(config)#

Moves you back one level

Router(config)# exit

Router#

Moves you back one level

end Command

Router(config-if)# end

Router#

Moves you from the current mode all the way down to privileged EXEC mode. This example moves from interface configuration mode down to privileged EXEC mode. Notice the prompt changes from Router(config-if)# to Router#

disable Command

Router# disable

Router>

Moves you from privileged EXEC mode back to user mode

logout Command

Router# logout Performs the same function as exit

Setup Mode

Setup mode starts automatically if there is no startup configuration present.

Router# setup Enters the System Configuration Dialog from the command line

Note

The answer inside the square brackets, [ ], is the default answer. If this is the answer you want, just press Image. Pressing Image at any time will end the setup process, shut down all interfaces, and take you to user mode (Router>).

Note

You cannot use the System Configuration Dialog (setup mode) to configure an entire router. It does only the basics. For example, you can only turn on RIPv1, but not Open Shortest Path First Protocol (OSPF) or Enhanced Interior Gateway Routing Protocol (EIGRP). You cannot create access control lists (ACLs) here or enable Network Address Translation (NAT). You can assign an IP address to an interface but not to a subinterface. All in all, setup mode is very limiting.

Entering the System Configuration Dialog is not a recommended practice. Instead, you should use the command-line interface (CLI), which is more powerful:

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

Would you like to enable autoinstall? [yes]: no

Autoinstall is a feature that tries to broadcast out all interfaces when attempting to find a configuration. If you answer yes, you must wait for a few minutes while it looks for a configuration to load. Very frustrating. Answer no.

Keyboard Help

The keystrokes in the following table are meant to help you edit the configuration. Because you’ll want to perform certain tasks again and again, Cisco IOS Software provides certain keystroke combinations to help make the process more efficient.

^

Router# confog t

           ^

% Invalid input detected at '^' marker.

Router# config t

Router(config)#

Shows you where you made a mistake in entering a command
Image Indicates that the line has been scrolled to left
Image Moves cursor to beginning of line
Image Moves cursor back one word
Image Moves cursor back one character
Image Moves cursor to end of line
Image Moves cursor forward one character
Image Moves cursor forward one word
Image Allows the user to interrupt an IOS process such as ping or traceroute
Image Moves you from any prompt back down to privileged EXEC mode. Can also be used to interrupt the output being displayed and return to privileged EXEC mode
Image Deletes the word to the left of the cursor
Image Deletes the entire line
Image Swaps or transposes the current character with the one before it
Image Erases characters from the cursor to the end of the line
Image Erases characters from the cursor to the beginning of the line
Image Deletes from cursor to the end of the word
Image Removes characters to the right of the cursor
Image Removes characters to the left of the cursor
Image Reprints the line
Image Refreshes the line—use this if the system sends a message to the screen while a command is being entered and you are not using line synchronization. This brings your command to the next line without the message interfering with the command
Image Exits from global configuration mode and moves you to privileged EXEC mode
Image Makes the letter at the cursor uppercase
Image Makes the letter at the cursor lowercase
Image Makes the letters from the cursor to the end of the word uppercase

Router# terminal no editing

Router#

Turns off the ability to use the previous keyboard shortcuts

Router# terminal editing

Router#

Reenables enhanced editing mode (can use previous keyboard shortcuts)

History Commands

Image Recalls commands in the history buffer in a backward sequence, beginning with the most recent command
Image Returns to more recent commands in the history buffer after recalling commands with the Image key sequence

terminal Commands

Router# terminal no editing

Router#

Turns off the ability to use keyboard shortcuts

Router# terminal editing

Router#

Reenables enhanced editing mode (can use keyboard shortcuts)
Router# terminal length x Sets the number of lines displayed in a show command to x, where x is a number between 0 and 512 (the default is 24)

Note

If you set the terminal length x command to zero (0), the router will not pause between screens of output.

Router# terminal history size number Sets the number of commands in the buffer that can be recalled by the router (maximum 256)
Router# terminal history size 25 Causes the router to remember the last 25 commands in the buffer
Router# no terminal history size 25 Sets the history buffer back to 10 commands, which is the default

Note

The history size command provides the same function as the terminal history size command.

Be careful when you set the size to something larger than the default. By telling the router to keep the last 256 commands in a buffer, you are taking memory away from other parts of the router. What would you rather have: a router that remembers what you last typed in or a router that routes as efficiently as possible?

show Commands

Router# show version Displays information about the current Cisco IOS Software
Router# show flash Displays information about flash memory
Router# show history Lists all commands in the history buffer

Note

The last line of output from the show version command tells you what the configuration register is set to.

Using the Pipe Parameter ( | ) with the show or more Commands

By using a pipe (|) character in conjunction with a show command or a more command, you can set filters for specific information that you are interested in.

Router# show running-config | include hostname Displays configuration information that includes the specific word hostname
Router# show running-config | section FastEthernet 0/1 Displays configuration information about the section FastEthernet 0/1
The Pipe Parameter (|) Options Parameter The Pipe Parameter (|) Options Description
begin Shows all output from a certain point, starting with the line that matches the filtering expression
Router# show running-config | begin line con 0 Output begins with the first line that has the regular expression “line con 0”
exclude Excludes all output lines that match the filtering expression
Router# show running-config | exclude interface Any line with the regular expression “interface” will not be shown as part of the output
include Includes all output lines that match the filtering expression
Router# show running-config | include duplex Any line that has the regular expression “duplex” will be shown as part of the output
Router# show running-config | include ( is ) Displays only lines that contain the regular expression ( is ). The parentheses force the inclusion of the spaces before and after “is”. This ensures that lines containing “is” with a space before and after it will be included in the output, and output without spaces will be excluded—words like “disconnect” or “isdn” will be excluded
section Shows the entire section that starts with the filtering expression
Router# show running-config | section interface GigabitEthernet 0/0 Displays information about interface GigabitEthernet 0/0
Router# more nvram: startup-config | begin ip Displays output from the startup-config file that begins with the first line that contains the regular expression “ip”
Router# more nvram: startup-config | include ip Displays output from the startup-config file that only includes the regular expression “ip”

Note

You can use the pipe parameter and filters with any show command.

Note

The filtering expression has to match exactly with the output you want to filter. You cannot use shortened forms of the items you are trying to filter. For example, the command

Router# show running-config | section gig0/0

will not work because there is no section in the running-config called gig0/0. You must use the expression GigabitEthernet0/0 with no spelling errors or extra spaces added in.

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.

Router(config)# router eigrp 100 Enables the EIGRP routing process with Autonomous System number 100
Router(config)# no router eigrp 100 Disables EIGRP routing process 100 and removes the entire EIGRP configuration from the running configuration
Router(config)# no ip routing Disables IP routing on the device (IP routing is enabled by default)
Router(config)# ip routing Reenables IP routing on the device

Many CLI commands also have a default form. By issuing the default command-name command, you can configure the command to its default setting. The Cisco IOS Software command reference documents located on Cisco.com describe the function of the default form of the command when it performs a different function from either the plain form or the no form of the command. To see what default commands are available on your system, enter default ? in the appropriate command mode:

Router(config)# default ? Lists all commands that are available at this mode for use with the default command
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.64.66