Basic IOS Command Structure
A Cisco IOS device supports many commands. Each IOS command has a specific format or syntax and can only be executed at the appropriate mode. The general syntax for a command is the command followed by any appropriate keywords and arguments. Some commands include a subset of keywords and arguments that provide additional functionality. Commands are used to execute an action, and the keywords are used to identify where or how to execute the command.
As shown in Figure 1, the command is the initial word or words entered in the command line following the prompt. The commands are not case-sensitive. Following the command are one or more keywords and arguments. After entering each complete command, including any keywords and arguments, press the Enter key to submit the command to the command interpreter.
The keywords describe specific parameters to the command interpreter. For example, the show command is used to display information about the device. This command has various keywords that must be used to define what particular output should be displayed. For example:
Switch# show running-config
The command show is followed by the keyword running-config. The keyword specifies that the running configuration is to be displayed as the output.
IOS Command Conventions
A command might require one or more arguments. Unlike a keyword, an argument is generally not a predefined word. An argument is a value or variable defined by the user. 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.
For instance the syntax for using the description command is:
Switch(config-if)# description string
As shown in Figure 2, boldface text indicates commands and keywords that are typed as shown and italic text indicates an argument for which you supply the value. For the description command, the argument is a string value. The string value can be any text string of up to 80 characters.
Therefore, when applying a description to an interface with the description command, enter a line such as this:
Switch(config-if)# description MainHQ Office Switch
The command is description and the user defined argument is MainHQ Office Switch.
The following examples demonstrate some conventions used to document and use IOS commands.
For the ping command:
Switch> ping IP-address
Example with values:
Switch> ping 10.10.10.5
The command is ping and the user defined argument is the 10.10.10.5.
Similarly, the syntax for entering the traceroute command is:
Switch> traceroute IP-address
Example with values:
Switch> traceroute 192.168.254.254
The command is traceroute and the user defined argument is the 192.168.254.254.