Cisco IOS Command Structure and Syntax


IOS Command Structure

The general syntax for a command, shown in the picture above, is the command followed by any appropriate elements (keywords and arguments).

  • Keyword - This is a specific parameter defined in the operating system (in the figure, ip protocols).
  • Argument - This is not predefined; it is a value or variable defined by the user (in the figure, 192.168.10.5).

IOS Command Syntax

A command might require one or more arguments. To determine the keywords and arguments required for a command, refer to the command syntax. The syntax provides the pattern, or format, that must be used when entering a command. Knowing the Cisco IOS command syntax will make it easier for us to read the documentation from Cisco.

Convention Description
boldface Boldface text indicates commands and keywords that you enter literally as shown.
italics Italic text indicates arguments for which you supply values.
[x] Square brackets indicate an optional element (keyword or argument).
{x} Braces indicate a required element (keyword or argument).
[x {y | z }] Braces and vertical lines within square brackets indicate a required choice within an optional element. Spaces are used to clearly delineate parts of the command.

For instance,

CiscoIOS(config)# ping {ip-address}

ping ip-address - The command is ping and the user-defined argument is the ip-address of the destination device. For example: ping 192.168.1.1, ping 1.1.1.1.

If a command is complex with multiple arguments, you may see it represented like this:

CiscoIOS(config)# enable secret [level level] {plaintex-password | [encryption-type] encrypted-password}

The above command is used to secure Privileged EXEC mode with a password. Based on above command syntax, there are several elements that we can fill. The primary command is enable secret. We can add two elemets: level (optional because it is in square brackets) and the password itself (required because it is in braces).

On the other hand, there are two types of passwords that we can enter. It's mandatory, we have to choose between the two. The first option is a clear-text password. The second option is an encrypted-password which encryption-type as optional atribute.

The following are examples:

  • enable secret s3cUr3!
  • enable secret 5 $1$mERr$z5pcRx1lxdNPdCGSLsyov0
  • enable secret level 15 s3cUr3!
  • enable secret level 15 $1$mERr$z5pcRx1lxdNPdCGSLsyov0
  • enable secret level 15 5 $1$mERr$z5pcRx1lxdNPdCGSLsyov0

IOS Context-sensitive Help

Context-sensitive help enables you to quickly find answers to these questions:

  • Which commands are available in each command mode?
  • Which commands start with specific characters or group of characters?
  • Which arguments and keywords are available to particular commands?

To access context-sensitive help, simply enter a question mark, ?, at the CLI.

Switch# show ?
  access-lists       List access lists
  arp                Arp table
  boot               show boot attributes
  cdp                CDP information
  clock              Display the system clock
  crypto             Encryption module
  dhcp               Dynamic Host Configuration Protocol status
  dtp                DTP information
  etherchannel       EtherChannel information
  flash:             display information about flash: file system
  history            Display the session command history
  hosts              IP domain-name, lookup style, nameservers, and host table
  interfaces         Interface status and configuration
  ip                 IP information
  lldp               LLDP information
  logging            Show the contents of logging buffers
  mac                MAC configuration
  mac-address-table  MAC forwarding table
  mls                Show MultiLayer Switching information
  monitor            SPAN information and configuration
  ntp                Network time protocol
  port-security      Show secure port information
 --More-- 

Command syntax check verifies that a valid command was entered by the user. When a command is entered, the command line interpreter evaluates the command from left to right. If the interpreter understands the command, the requested action is executed, and the CLI returns to the appropriate prompt. However, if the interpreter cannot understand the command being entered, it will provide feedback describing what is wrong with the command.

Tags: cisco ios configuration, how to get help in cisco ios command line, cisco documentation format, cisco command structure, cisco ios command syntax, cisco help features, cisco command format, cisco configuration example, cisco help, cisco documentation

Disqus Comments