The Cisco IOS Command Hierarchy — Where Are You, and What Can You Do?
The Cisco IOS CLI has a strict hierarchy of modes. Knowing which mode you’re in determines what commands are available, and accidentally typing a config command in the wrong mode is the second-most-common newbie mistake. (The first is confusing wildcard masks for subnet masks.)
| Mode | Prompt | Enter from |
|---|---|---|
| User EXEC | Router> |
Initial login (limited) |
| Privileged EXEC | Router# |
enable from User EXEC |
| Global Configuration | Router(config)# |
configure terminal |
| Interface Config | Router(config-if)# |
interface Gi0/1 |
| Router Config | Router(config-router)# |
router ospf 1 |
| Line Config | Router(config-line)# |
line vty 0 4 |
| ROMMON | rommon 1 > |
Break sequence at boot |
exit backs up one level. end jumps straight to Privileged EXEC. Ctrl-Z is equivalent to end. The mnemonic is built into the prompts: the more parentheses, the deeper you are.
Navigation and Time-Saving Shortcuts
Most CCNA candidates type the long form of every command. Stop. The IOS CLI has tab-complete and is forgiving about prefixes:
- Tab — complete a partial keyword
- ? — context-aware help; type
show ip ?to see all show ip commands - Ctrl-A / Ctrl-E — cursor to start / end of line
- Ctrl-W — delete previous word
- Ctrl-U — delete to start of line
- Ctrl-R — redraw current line (useful when console messages interrupt)
- Up arrow — previous command in history
- Esc-B / Esc-F — back / forward one word
Command abbreviation: any unambiguous prefix works. conf t = configure terminal. sh ip int br = show ip interface brief. The shorter forms work in production scripts and on certification labs alike.
Output Filtering with Pipes
The show commands often produce thousands of lines. Three pipe modifiers tame them:
Router# show running-config | include hostname
Router# show running-config | begin interface
Router# show running-config | exclude !
Router# show ip route | section ospf
include <regex>— only lines that matchexclude <regex>— only lines that don’t matchbegin <regex>— start at the first match, show everything aftersection <regex>— show whole config sections (not all IOS versions)
Pipe to a file: show tech-support | redirect tftp://10.1.1.5/show-tech.txt — useful when capturing diagnostic output for TAC.
The Ping Result Codes
Cisco IOS’s extended ping output uses single-character codes per echo. Memorize them:
- ! — success (echo reply received)
- . — timeout (no reply within wait time)
- U — destination unreachable received
- Q — source quench (rare; rate-limited)
- M — could not fragment
- ? — unknown packet type
- & — TTL exceeded
A response of ..... means total black hole; U.U.U typically means a router on path is dropping with ICMP unreachable.
ROMMON — The Bootstrap Recovery Console
ROMMON (ROM Monitor) is a tiny console you reach before IOS loads — a recovery shell stored in ROM. You break into it during the first 60 seconds of boot by sending the break sequence from your terminal emulator:
- PuTTY: Special Command > Break
- SecureCRT: Ctrl+Break
- Tera Term: Alt+B
- Linux minicom: Ctrl+A then F
What ROMMON does that IOS can’t: ignore the startup-config, change the configuration register, load IOS via TFTP from a known-good source.
Password Recovery — The Standard Procedure
You inherited a router. Nobody knows the enable password. The configuration register lets you boot the router while ignoring the saved config — that’s the recovery loophole.
Step 1 — Break to ROMMON
Power-cycle the router with a console session active. Send the break sequence within the first 60 seconds. You should see:
rommon 1 >
Step 2 — Tell the router to ignore startup-config
rommon 1 > confreg 0x2142
rommon 2 > reset
The 0x2142 register value tells the router to skip loading startup-config on boot. Default register is 0x2102, which loads it normally.
Step 3 — Load saved config without applying it
The router boots clean (no config). Get to privileged EXEC and load the saved config into running-config:
Router> enable
Router# copy startup-config running-config
Now the running config is loaded but you have privileged access (because the boot bypassed the password check).
Step 4 — Set a new enable password
Router# configure terminal
Router(config)# enable secret NewPassw0rd!
Router(config)# config-register 0x2102
Router(config)# end
Router# copy running-config startup-config
Router# reload
Critical: don’t forget to set the config-register back to 0x2102. If you leave it at 0x2142, the router will boot ignoring config every time you reload.
Useful ROMMON Commands
| Command | Purpose |
|---|---|
set |
List ROMMON variables |
dir flash: |
List files on flash (when accessible) |
boot flash:c2900-uni.bin |
Boot a specific IOS image manually |
tftpdnld |
Download IOS image via TFTP (requires preset variables) |
confreg 0x2102 |
Reset config register to default |
For TFTP download in ROMMON, set these variables first:
rommon 1 > IP_ADDRESS=10.1.1.10
rommon 2 > IP_SUBNET_MASK=255.255.255.0
rommon 3 > DEFAULT_GATEWAY=10.1.1.1
rommon 4 > TFTP_SERVER=10.1.1.5
rommon 5 > TFTP_FILE=c2900-uni.bin
rommon 6 > tftpdnld
Common Pitfalls
- Forgetting to restore config-register. After password recovery, set
config-register 0x2102in global config or the router boots clean every time. - Break sequence not getting through. Some terminal emulators don’t send a real break by default. Test on a known-working device first.
- Console rate mismatch. ROMMON sometimes runs at 9600 baud while IOS uses your configured rate. If output is gibberish in ROMMON, drop your terminal to 9600.
- Ignoring tab-complete. CCNA students who type
show running-configurationin full are wasting time.sh runworks. - Pipe regex case. IOS pipe matching is case-sensitive by default. Use the
-iequivalent isn’t available; pipe throughinclude OSPFnotinclude ospfif the output is uppercase.
Conclusion
The IOS CLI rewards deep familiarity. Five habits that compound over a career:
- Use abbreviations and tab-complete — you’ll save hours.
- Pipe every long
showthrough| includeor| begin. - Memorize ping result codes; they’re the first diagnostic you reach for.
- Practice the password-recovery procedure on a lab router until you can do it from memory.
- Keep a console cable and a known-good TFTP server within reach — that’s the recovery toolkit.