Using Help and Tab Completion
Lab Objectives
- Learn to use context help (
?) to discover IOS commands and subcommands. - Practice Tab completion to speed up typing and avoid mistakes.
- Use the command history (Up Arrow) to recall and edit previous commands.
Lab Tasks (Try It Yourself First!)
Complete these tasks WITHOUT looking at the solution below. Use
?andshowcommands to figure it out.
Task 1: Discover the command to show OSPF routes
Using context help, find the exact IOS command that displays routes learned by OSPF on R1. You are looking for a show command that limits the output to OSPF-learned routes.
Parameters:
- Device: R1
- Goal: Identify the
showcommand that displays only OSPF routes (no other routes).
Task 2: Use Tab completion to type commands faster
Use Tab completion to finish two partially typed commands on R1:
- Complete
show ip rointo the fullshow ip routecommand. - Complete the interface name
Gi0/0when issuingshow ip interface brief Gi0/0.
Parameters:
- Device: R1
- Goal: Demonstrate Tab completion for both a command and an interface name.
Task 3: Use the Up Arrow to edit a previous command
Run the OSPF-only route command you discovered in Task 1. Then use the Up Arrow key to recall that command, edit out the ospf keyword so you run show ip route (full routing table), and execute it.
Parameters:
- Device: R1
- Goal: Recall, edit, and re-run a previous command using command history.
Think About It: Why is it safer in production to use Tab completion and context help instead of guessing a command name when you’re in a live router?
Lab Solution
ASCII Topology (use this exact topology)
[Internet]
203.0.113.1
|
R1 (Gateway)
Gi0/0: 10.10.10.1
Gi0/1: 10.10.20.1
Gi0/2: 10.10.30.1
/ | \
R2 R3 R4
Gi0/0: 10.10.10.2 | Gi0/0: 10.10.30.2
Gi0/1: 10.10.40.1 |
/ \ |
S1 S2 S3
/ \ | /
PC1 PC2 PC3 PC4 PC5
IP SCHEME (reference)
- 10.10.10.0/24 — R1-R2 link
- 10.10.20.0/24 — R1-R3 link
- 10.10.30.0/24 — R1-R4 link
- 10.10.40.0/24 — R2-S1 link
- 192.168.1.0/24 — VLAN 10 (Sales)
- 192.168.2.0/24 — VLAN 20 (Engineering)
- 192.168.3.0/24 — VLAN 30 (Management)
- 203.0.113.0/24 — Public/Internet simulation
Tip: In IOS, context help (
?) shows valid words at the current cursor position. Tab completes the current token when there is a unique match. The Up Arrow traverses the command history — ideal for small edits.
Task 1 Solution: Discover the command to show OSPF routes
What we are doing: We will use context help to discover the exact show command that displays routes learned via OSPF. This avoids guessing command syntax.
R1# show ip ?
access-lists Access list management
arp ARP table and ARP control
dhcp DHCP information
interface Interface status and configuration
route Routing table information
...
R1# show ip route ?
<1-4294967295> IP route prefix
connected Connected routes
static Static routes
ospf OSPF routes
bgp BGP routes
...
What just happened:
show ip ?lists the availableshow ipsubcommands. That showsrouteis available.show ip route ?reveals protocol-specific filters. You can typeospfto limit the output to routes learned via OSPF.- Using
?at each step prevents guessing and shows exactly what the IOS expects.
Verify:
R1# show ip route ospf
O 10.10.40.0/24 [110/65] via 10.10.10.2, 00:00:12, GigabitEthernet0/0
O 192.168.1.0/24 [110/65] via 10.10.10.2, 00:00:12, GigabitEthernet0/0
O 192.168.2.0/24 [110/65] via 10.10.10.2, 00:00:12, GigabitEthernet0/0
O 192.168.3.0/24 [110/65] via 10.10.10.2, 00:00:12, GigabitEthernet0/0
- The output shows OSPF-learned routes (prefixed with
O) and their next-hop via 10.10.10.2 (R2). In production, filteringshow ip routeby protocol helps you quickly confirm which routes were learned from a specific routing protocol.
Task 2 Solution: Use Tab completion to type commands faster
What we are doing: Demonstrate Tab completion for both a multi-word command and an interface name. Tab completion speeds typing and avoids typos.
R1# show ip ro<TAB>
R1# show ip route
R1# show ip interface brief Gi0/0<TAB>
R1# show ip interface brief GigabitEthernet0/0
What just happened:
- Typing
show ip rothen pressing<Tab>completed the command toshow ip route. Tab matched a unique continuation. - Typing the abbreviated interface
Gi0/0then pressing<Tab>expanded it to the full interface tokenGigabitEthernet0/0. This avoids mistyping long interface names and is especially useful in complex device inventories.
Verify:
R1# show ip interface brief GigabitEthernet0/0
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 10.10.10.1 YES manual up up
- This output confirms both the interface name completion and the configured IP address/state. In production, Tab completion reduces risk during maintenance windows.
Task 3 Solution: Use the Up Arrow to edit a previous command
What we are doing: Run show ip route ospf, recall it with the Up Arrow, remove the ospf filter, and run show ip route to display the full routing table.
R1# show ip route ospf
[as in Task 1 output]
<Press Up Arrow to recall previous command>
R1# show ip route ospf
<Edit line to remove 'ospf'>
R1# show ip route
Codes: C - connected, S - static, O - OSPF, etc.
C 10.10.10.0/24 is directly connected, GigabitEthernet0/0
C 10.10.20.0/24 is directly connected, GigabitEthernet0/1
C 10.10.30.0/24 is directly connected, GigabitEthernet0/2
O 10.10.40.0/24 [110/65] via 10.10.10.2, GigabitEthernet0/0
O 192.168.1.0/24 [110/65] via 10.10.10.2, GigabitEthernet0/0
O 192.168.2.0/24 [110/65] via 10.10.10.2, GigabitEthernet0/0
O 192.168.3.0/24 [110/65] via 10.10.10.2, GigabitEthernet0/0
What just happened:
- The Up Arrow recalled the most recent command in the session (
show ip route ospf), so you didn't have to retype it. - Editing the recalled command and removing
ospfproduced the full routing table. Using command history is invaluable when you want to re-run and slightly modify previous diagnostics during troubleshooting.
Troubleshooting Scenario
Scenario: Tab completion appears to insert spaces instead of completing
Symptom: Pressing Tab after show ip ro inserts spaces rather than completing to route. You can’t complete interface names either.
Your task: Find and fix the issue.
Hint: Check the CLI terminal emulation setting and the IOS line-editing mode (some terminal programs send different key codes).
Solution:
- Often the cause is the terminal emulator configured to send VT100/other codes that IOS doesn’t interpret as Tab, or the terminal has been set to a mode where Tab is mapped differently.
- Switch your terminal emulator to send a real Tab character (ASCII 0x09) or use a different emulator. Verify by pressing Ctrl+V then Tab in a local shell — it should show ^I in many shells; in your terminal settings enable “send Tab”.
- If the problem is still present, you can type the full token;
?always works as a fallback to discover available words.
Verification (example):
R1# show ip ro<TAB>
R1# show ip route
Important note: If Tab does not work,
?will still display valid completions. Use?if your terminal doesn't support Tab.
Verification Checklist
- Used
?to identify theshow ip route ospfcommand. - Used Tab to complete
show ip rointoshow ip route. - Used Tab to complete
Gi0/0intoGigabitEthernet0/0. - Recalled and edited a previous command using the Up Arrow.
Common Mistakes
| Symptom | Cause | Fix |
|---|---|---|
| Tab inserts spaces or does nothing | Terminal emulator not sending real Tab | Configure emulator to send Tab or use ? as fallback |
show ip route ospf returns no results | OSPF not running or no OSPF neighbors | Verify routing protocol config and neighbor adjacency; use show ip ospf neighbor (challenge) |
| Recalled command is not the one expected | Multiple previous commands in session; wrong command recalled | Press Up/Down Arrow to select correct entry or retype / use ? to rediscover |
Challenge Task
On R1, use ? and Tab to discover and run a command that shows OSPF neighbor relationships (no step-by-step). Then use the Up Arrow to edit that command to show only the neighbor ID column. Goal: find and run the appropriate show ip ospf ... command, relying only on help and completion features.
Real-world context: Mastering context help, Tab completion, and command history makes you faster and safer on production devices. Guessing syntax can lead to typos that accidentally change configuration; relying on help avoids those risks and speeds troubleshooting during critical incidents.