CLI Structure and Navigation

Command Modes

The Cisco IOS command-line interface (CLI) is structured hierarchically with the following command modes:

User EXEC mode
This is the default mode when logging into a Cisco device. It offers limited access, allowing only basic monitoring commands and restricting the ability to make configuration changes. It is identifiable by a prompt ending with >.

Privileged EXEC mode
This elevated mode grants access to all show commands and system-level operations. It provides complete visibility into the system but no configuration access. It also enables users to perform device diagnostics and file management tasks. This mode is denoted by a prompt ending with #.

Global Configuration mode
This highly privileged mode allows you to make system-wide configuration changes and provides access to various sub modes for specific configurations, such as interface settings. In this mode, the prompt includes (config)#.

Moving Between Command Modes

When you first log into a Cisco router or switch, you will be in User EXEC mode. Use the following commands to switch to more privileged modes:

Command Description
enable Used to access Privileged Exec mode
config terminal (or simply config t) Used to access Global Configuration mode

These commands are shown in the example below:

Router>enable
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#

Global Configuration mode can be further divided into several sub-modes that permit you to configure different components. Here are those sub-modes and the commands to access them:

Configuration Mode Command
Interface Configuration mode interface [interface-type] [interface-number]
Subinterface Configuration mode interface [interface-type] [interface-number].[subinterface-number]
Router Configuration mode router [routing-protocol]
Line Configuration mode line [line-type] [line-number]

Now that you know the commands to move to the higher privileged modes, here are the commands to work your way back out of them:

Command Description
exit Used to move back one level in the configuration mode hierarchy
end Used to immediately return to Privileged EXEC mode from any configuration mode. This is useful for quickly exiting nested configuration levels.

The following example shows the admin returning to Privileged Exec mode:

Router#enable
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#exit
Router#

Displaying System Configuration

After logging onto a Cisco device, you probably want to view its basic system settings. This is easily done by typing show running-config or simply show run. This command displays the active configuration stored in the device’s memory.

Notice in the example below that we first tried the command while in User Exec mode, where it failed due to insufficient privileges. The output shows only a portion of the running config.

Router>show run
^ Invalid input detected at marker.

Router>enable
Router#show run
Building configuration...

Current configuration: 646 bytes
!
version 16.6.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!

Other commands related to configuration include the following:

Command Description
show startup-config Displays the saved configuration stored in the device’s NVRAM, which will be loaded when the device starts up
copy running-config startup-config Replaces the startup config with the active config when the Cisco network device initializes
copy startup-config running-config Merges the startup config with the currently active config in RAM
write erase / erase startup-config Deletes the startup config

Shortcuts and Command History

Here are a few additional commands for quick navigation:

Command/Shortcut Description
Ctrl+Z Use this key combination at any time to instantly exit any configuration mode and return to Privileged EXEC mode
Tab key Use this key to auto-complete partial commands or show possible completion options
Up & down arrow keys Use these keys to cycle through previous commands
show history Use this command to display the command history buffer