• 12 hours
  • Medium

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 6/30/22

Understand the Command Line Interface (CLI)

Get to Know the CLI

Most connectivity devices can be configured using either a graphical user interface or a command line interface. A command line interface (CLI) can give the network administrator more detailed control and flexibility than a graphical user interface.

Screenshot of the command line interface
In Cisco Packet Tracer, you can access the command line interface by clicking on the connectivity device and then going to the “CLI” menu

Manage Execution Modes

For security reasons, the Cisco IOS separates access to management functions into two command modes:

  • User EXEC mode: This mode provides limited functionality, but is still useful for basic operations. It allows only a limited number of basic monitoring commands, but doesn’t allow any command that would change the device configuration. User execution mode can be recognized from the CLI prompt ending with the > symbol.

  • Privileged EXEC mode: This mode allows the operator to execute configuration commands. To access higher configuration modes such as global configuration mode, you need to use privileged EXEC mode, which is the main mode that a network administrator would use. Privileged EXEC mode can be recognized from the CLI prompt ending with the # symbol.

The following table summarizes the two modes and displays the default command line interface prompts for Cisco switches and routers.

Execution Mode

Description

Default device prompt

User EXEC mode

  • This mode allows only a limited number of basic monitoring commands.

  • It’s often known as “view only”.

Switch>

Router>

Privileged EXEC mode

  • This mode provides access to all commands and features.

  • The operator has access to all monitoring, configuration and management commands.

Switch#

Router#

To configure the device, the operator must use global configuration mode. This mode can be recognized from a command prompt that ends with(config)#after the name of the device. For example: Switch(config)#

From global configuration mode, you can access two commonly used configuration sub-modes:

  • Line configuration mode: Used to configure access by console, SSH, Telnet or AUX. The default prompt for line configuration mode isSwitch(config-line)#.

  • Interface configuration mode: Used to configure the network interface of a port (or a number of ports) on a switch or router. The default prompt for interface configuration mode isSwitch(config-if)#.

We’ll use different commands to enter and exit these different configuration modes:

  • To go from user mode to privileged mode, you’ll need to use theenable command. 

  • To go back from privileged mode to user mode, you’ll use thedisablecommand.

To enter global configuration mode, use the privileged EXEC mode commandconfigure terminal. To go back to privileged EXEC mode, use theexitcommand.

There are a number of different configuration sub-modes available, but the most commonly used are: 

  • Line configuration sub-mode, which can be accessed using thelinecommand.

  • Interface configuration sub-mode. Use interfaceto access it. 

To exit a configuration sub-mode and return to the global configuration mode, use theexitcommand.

Here are the different configuration modes we’ve previously seen when using the Cisco Packet Tracer CLI:

Switch> enable 
Switch# configure terminal 
Enter configuration commands, one per line. End with 
CNTL/Z. 
Switch(config)# line console 0 
Switch(config-line)# exit 
Switch(config)# interface FastEthernet0/1 
Switch(config-if)# exit 
Switch(config)# exit 
Switch# 
%SYS-5-CONFIG_I: Configured from console by console 

Switch#

To save time, try typing just the first characters of the command. Like this:

Switch> en 
Switch# conf t 
Enter configuration commands, one per line. End with 
CNTL/Z. 
Switch(config)# line c 0 
Switch(config-line)# exit 
Switch(config)# int F0/1 
Switch(config-if)# exit 
Switch(config)# exit 
Switch# 
%SYS-5-CONFIG_I: Configured from console by console 

Switch#

Most of the commands that you’re going to use in the various configuration modes and sub-modes can only be executed within that particular mode or sub-mode. If you're not sure, type the?character to get help.

Illustration showing the user execution mode on the left, and the privileged execution mode on the right.
User EXEC mode (left) and privileged EXEC mode (right)

Let's Recap!

In this chapter, you’ve seen:

  • an introduction to the CLI (command line interface) of a Cisco connectivity device.

  • an introduction to the different configuration modes and sub-modes within a Cisco switch.

Now that you’ve been introduced to the CLI, you’ll be able to configure the basic parameters in a layer 2 switch.

Example of certificate of achievement
Example of certificate of achievement