VMware ESXi and vSphere Cluster Management
Using Context-Sensitive Help and Command Completion in Cisco IOS
Learn how Cisco IOS context-sensitive help, question-mark discovery, Tab completion, abbreviations, pagination, and command history simplify CLI work.
Cisco IOS is Cisco's network device operating system and command-line environment. Its command-line interface (CLI) lets you configure, monitor, and troubleshoot a router or switch by entering text commands.
This lesson explains how to discover valid IOS syntax without leaving the CLI. You will use the question mark (?), Tab completion, command abbreviations, paginated-output controls, and command history.
What Context-Sensitive Help Does
Context-sensitive help is IOS assistance that displays commands or syntax valid at the current command position and in the current command mode. A command mode is the active execution or configuration context that determines which commands are available.
For example, the commands available at a user EXEC prompt are not the same as those available at a privileged EXEC prompt or in global configuration mode. Help also changes as you enter more of a command, because IOS narrows the possible syntax at each position.
This makes the help system useful for discovering syntax while remaining in the CLI. You do not need to leave the terminal to look up every keyword or option.
Common IOS modes
| Mode | Typical prompt | Purpose | How help output differs |
|---|---|---|---|
| User EXEC | Router> | Limited operational access | Lists only commands permitted in the user EXEC context. |
| Privileged EXEC | Router# | Administrative monitoring, troubleshooting, and access to configuration modes | Includes more operational commands than user EXEC, such as many show and debug branches. |
| Global configuration | Router(config)# | Device-wide configuration | Lists configuration commands rather than ordinary EXEC commands. |
The prompt is an important clue. If expected commands are missing, first verify that you are in the correct mode. A command may also be unavailable because of the device platform, IOS release, or installed feature set.
Using the Question Mark for Command Discovery
The question mark is the primary IOS help character. It displays choices that are valid at the current point in a command.
List commands at an empty prompt
Enter a question mark immediately after the prompt:
Router# ?IOS lists the commands available in privileged EXEC mode. The exact list varies by platform, software release, and device state. At a user EXEC or configuration prompt, the list will be different.
Filter commands by a partial word
Type part of a command and then type a question mark immediately, with no space between the partial word and the question mark:
Router# de?This requests partial-command help. IOS displays command names that begin with de, such as commands whose full names start with that prefix. The question mark is used for discovery; it is not normally included as part of the command you eventually execute.
Display the next valid keyword or argument
To see what can follow a complete command word, enter the command, a space, and then a question mark:
Router# debug ?This is different from de?. The first form filters command names beginning with a prefix. The second form asks IOS what may come after the debug keyword. The response can contain more keywords, subcommands, parameters, or argument types.
Help descriptions may indicate whether IOS expects a fixed keyword or a value. A keyword is a fixed word in command syntax, such as interface or brief. An argument is a value supplied by the administrator, such as an interface identifier, address, or protocol parameter.
Discovering Multiword Command Syntax
Use help progressively. Enter one known part of a command, ask for the next choices, select a valid continuation, and ask again.
Router# debug ?The available choices after debug may include protocol or feature categories. If the device supports the relevant branch, continue exploring it:
Router# debug eigrp ?The second query displays EIGRP-specific debug options that can follow debug eigrp. This method works for many multiword command families, not only diagnostic commands.
Progressive queries help you determine which portions of a command are required and which branches or options are available. The exact choices depend on the IOS version and platform. Because debug can generate substantial device output and CPU load, use it carefully in production environments and stop debugging when it is no longer needed.
Navigating Paginated Help Output
A long command list may pause at a more prompt. This means IOS has more output to display and is waiting for a navigation key.
- Spacebar: Display the next screen of output.
- Enter: Display the next line.
- q: Stop displaying the current output.
Pagination is useful because it prevents a large listing from scrolling past before you can read it. If a listing is difficult to read, use Enter for careful line-by-line review or q to stop and issue another command.
Tab-Based Command Completion
Pressing Tab completes a partially entered command or keyword when IOS can identify exactly one matching choice.
Router# sh<Tab>When sh has one valid match in that command position, IOS expands it to show. Completion reduces typing while preserving the correctly spelled IOS keyword.
Tab cannot complete the input when the characters match multiple possible keywords, when the text is invalid in the current position, or when no single valid match exists. In those cases, use question-mark help to inspect the available choices, then type more distinguishing characters.
IOS Command Abbreviation
IOS often accepts a shortened command word when the abbreviation is unique within its position in the command. Each keyword in a multiword command can often be abbreviated independently.
Router# sh ip int bThis is an accepted abbreviated form of:
Router# show ip interface briefThe full command displays a concise summary of interface status and IP addressing. In the abbreviated version, each token must identify only one valid keyword at that position. An abbreviation that works on one device or IOS release may not be safe on another if available commands differ.
Use context-sensitive help to verify abbreviations instead of guessing. Full commands are often preferable in documentation, automation, and instructional material because they are easier for other people to understand.
Understanding Ambiguous Command Errors
An ambiguous command error occurs when the characters entered could refer to more than one valid command or keyword. IOS cannot safely choose an interpretation.
Router# sh ip in bA device may respond with an error similar to:
% Ambiguous command: "show ip in b"Here, the in prefix is not specific enough in that command position. Add characters until the intended keyword is unique:
Router# sh ip int bThe additional t distinguishes interface from other possible keywords beginning with the same prefix. A valid abbreviation is therefore not merely short; it is uniquely identifiable.
| Entered command | IOS interpretation | Outcome | Reason |
|---|---|---|---|
sh ip int b | show ip interface brief | Valid | Each abbreviated token is unique in its position. |
sh ip in b | Could match more than one continuation | Ambiguous | in does not distinguish the intended keyword. |
| A short prefix shared by several listed choices | No single interpretation | More characters required | Use question-mark help to compare the competing prefixes. |
Help, Command Modes, and Command History
Command modes explain why the same question-mark request can produce different output at different prompts. Before troubleshooting a missing command, check whether the prompt shows user EXEC, privileged EXEC, or a configuration context.
Command history is a complementary feature. Help discovers valid syntax at the current command position; history retrieves commands that you entered previously.
Router# show historyThe show history command displays commands retained in the current CLI history. Depending on the terminal and IOS line-editing settings, history keys may also let you recall and edit earlier commands.
Help and Input Shortcut Reference
| Input or key | When to use it | Result | Example |
|---|---|---|---|
? at an empty prompt | You need all commands available in the current mode. | Lists valid commands for that mode. | Router# ? |
Partial text followed by ? | You know the beginning of a command word. | Lists commands beginning with that prefix. | Router# de? |
Command, space, then ? | You need the next syntax choice. | Lists valid next keywords, subcommands, parameters, or argument types. | Router# debug ? |
| Tab | A partial token may have one unique match. | Completes the command or keyword. | Router# sh<Tab> |
| Spacebar during paginated output | You want the next screen. | Advances one page. | Press Space at the more prompt. |
| Enter during paginated output | You want to read gradually. | Advances one line. | Press Enter at the more prompt. |
q during paginated output | You no longer need the listing. | Stops the displayed output. | Press q at the more prompt. |
Troubleshooting Help and Completion
A partial command does not execute
The prefix may match more than one command or keyword. Enter a question mark after the partial token to see the competing matches, then add enough characters to make the intended word unique.
Tab does not complete the input
The input may be ambiguous, invalid in the current command position, or unmatched. Check the prompt and use context-sensitive help. Correct the prefix or add more characters before pressing Tab again.
Expected commands are absent
Verify the current prompt and enter the required mode. If the mode is correct, the command may not be supported by that platform, IOS release, or feature set.
A help listing is difficult to read
Look for the more prompt. Press Space for another page, Enter for one line, or q to stop the output.
A short form works sometimes but not always
IOS abbreviations are valid only when every token is uniquely distinguishable. Compare the prefix with the choices shown by question-mark help, then use a longer abbreviation or the full command.
Practical Learning Sequence
- Identify the prompt and determine the current command mode.
- Enter
?at an empty prompt to inspect available commands. - Use a partial token such as
de?to filter command names. - Use a space followed by
?to discover valid continuations. - Repeat the process for deeper branches, such as
debug eigrp ?. - Press Tab when a prefix appears to have one unique match.
- Use abbreviations only after verifying that every token is unique.
- Use
show historywhen you need to recall earlier input rather than discover new syntax.
For continued practice, review Cisco IOS help and CLI discovery while testing each technique in the mode where you intend to use it.