Cisco IOS from the console: the commands everything else assumes
How a switch boots, the modes and prompts, the two configuration files and the difference between them, setting up remote access safely, and the handful of show commands and shortcuts that make the rest of the series readable.
On this page
Every later article in this series ends up at a command prompt, and the prompt has opinions: which mode you are in decides which commands exist, and typing a perfectly correct command in the wrong place produces a cryptic complaint about an invalid input. Half an hour spent on the shell itself makes everything afterwards feel like configuration rather than combat.
The map
Read this first when short on time. Every branch is a section below.
Getting a prompt in the first place
A brand new switch has no IP address, so the only way in is the console port: a physical serial connection that works regardless of configuration, and the one thing that still saves you when everything else is broken.
Older devices use a light blue rollover cable with an RJ45 plug at the device end and a DB9 serial connector at the other; anything recent has a USB console port instead. Either way the serial settings are the same, and they have not changed in decades: 9600 baud, 8 data bits, no parity, 1 stop bit, no flow control. Terminal software — PuTTY on Windows, screen or minicom on Linux and macOS — connects to the resulting serial device.
Once a management address and SSH exist you use those, but the console keeps two exclusive powers: you can watch the device boot, and you can perform password recovery, which requires interrupting the boot sequence with a break signal.
What happens between power and prompt
- POST — power-on self test, run from ROM, checking CPU, memory and interfaces.
- Bootstrap — a small program in ROM whose only job is to find and load a real operating system.
- Load IOS — normally the image file in flash memory. If flash is empty or corrupt, the device falls back to ROMMON, a minimal prompt where you can copy an image over.
- Load the configuration — IOS looks in NVRAM for
startup-configand applies it line by line. If there is none, it offers the initial setup dialog, which everyone declines in order to configure by hand.
A device that boots to rommon 1> has failed to load an image; a device that asks "Would you like to enter the initial configuration dialog?" has booted fine but found no startup configuration. The two look equally alarming and mean completely different things.
Modes: the prompt tells you where you are
IOS separates commands into modes, so destructive operations are not one typo away from a read-only session. The end of the prompt always tells you which mode you are in.
flowchart TD U["User exec<br/>Switch><br/>ping, show version"] -->|enable| P["Privileged exec<br/>Switch#<br/>all show, reload, copy"] P -->|disable| U P -->|configure terminal| G["Global config<br/>Switch config<br/>hostname, ip route"] G -->|exit| P G -->|interface Gi0/1| I["Interface config<br/>Switch config-if"] G -->|line vty 0 15| L["Line config<br/>Switch config-line"] I -->|end| P L -->|end| P
exit moves up one level; end or Ctrl-Z jumps straight back to privileged exec from anywhere.| Mode | Prompt | Entered by | What it is for |
|---|---|---|---|
| User exec | Switch> | Logging in | Basic checks: ping, traceroute, a few show commands |
| Privileged exec | Switch# | enable | Everything read-only, plus reload, copy, debug, erase |
| Global config | Switch(config)# | configure terminal | Device-wide settings |
| Interface config | Switch(config-if)# | interface Gi0/1 | Settings for one port |
| Line config | Switch(config-line)# | line vty 0 15 | Console and remote login settings |
| Router config | Switch(config-router)# | router ospf 1 | A routing process |
Two rules cover almost every navigation question. exit goes up exactly one level. end — or Ctrl-Z — returns to privileged exec from any depth. And commands only exist in their own mode: ip address is meaningless in global config, because the device would not know which interface you meant.
You can run a privileged exec command from inside config mode by prefixing it with do. do show ip interface brief saves leaving config mode to check something and then finding your way back.
Two configuration files, and the one that bites
Every IOS device holds two configurations, and understanding the difference prevents the most avoidable outage in networking.
Switch# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
Switch# write memory ! the older shorthand, still works
Switch# show startup-config ! what will load next boot
Switch# erase startup-config ! factory reset, takes effect after reloadThe asymmetry is worth internalising. There is no "apply" step: typing a command is the change. But there is a save step, and skipping it means the change quietly disappears at the next power cut.
Experienced engineers turn the danger into a tool. Before a risky change to a remote device — an ACL, a routing statement, anything that could cut your own session — schedule an automatic rollback:
Switch# reload in 10
Switch# ! ... make the change, verify it works ...
Switch# reload cancelIf the change locks you out, the device reboots in ten minutes into the last saved configuration and gives you your session back. If it works, you cancel the reload and save.
Undoing things
Nearly every configuration command is removed by typing no in front of it. no shutdown enables an interface, no ip address removes an address, no username bob deletes a user. The symmetry is close to universal, which makes reading a configuration much easier than it looks: everything you see was typed, and everything can be untyped.
The commands you will actually type
A short list covers most days. Here is a switch going from factory state to something usable.
Switch> enable
Switch# configure terminal
Switch(config)# hostname ACCESS-SW1
ACCESS-SW1(config)# no ip domain-lookup
ACCESS-SW1(config)# interface vlan 1
ACCESS-SW1(config-if)# ip address 10.10.10.5 255.255.255.0
ACCESS-SW1(config-if)# no shutdown
ACCESS-SW1(config-if)# exit
ACCESS-SW1(config)# ip default-gateway 10.10.10.1
ACCESS-SW1(config)# interface GigabitEthernet0/1
ACCESS-SW1(config-if)# description Uplink to DIST-SW1 Gi1/0/24
ACCESS-SW1(config-if)# no shutdown
ACCESS-SW1(config-if)# end
ACCESS-SW1# copy running-config startup-configTwo lines in there are worth explaining. no ip domain-lookup stops the device from treating a mistyped command as a hostname and trying to resolve it — without it, a typo hangs your session for thirty seconds while DNS times out, and it is the single most irritating default in IOS. And a switch gets its management address on a VLAN interface, not on a physical port, because switch ports are layer 2 and have no addresses of their own.
Show commands, in order of usefulness
| Command | Answers |
|---|---|
show ip interface brief | Every interface, its address, and whether it is up. The first command in almost every session. |
show running-config | The live configuration in full. |
show version | IOS version, uptime, model, serial number, and the configuration register. |
show interfaces Gi0/1 | Speed, duplex, errors, drops and traffic counters for one port. |
show interfaces status | A one-line-per-port table: connected or not, VLAN, duplex, speed, media type. |
show mac address-table | Which MAC addresses the switch has learned and on which ports. |
show ip route | The routing table. |
show cdp neighbors detail | What is plugged into each port, including its addresses and model. |
show logging | The device's own log buffer — usually where the answer already is. |
Filtering output
A full configuration can run to thousands of lines, so IOS supports a pipe with four useful filters:
Switch# show running-config | section interface GigabitEthernet0/1
Switch# show running-config | include username
Switch# show ip route | exclude 0.0.0.0
Switch# show interfaces | begin GigabitEthernet0/5section prints a whole configuration block and is the one people discover last and then use constantly.
- Network automation tools such as Ansible and Netmiko drive exactly these commands over SSH, screen-scraping the output — which is why the automation article spends so much time on why that is a fragile way to manage devices.
- Cisco Packet Tracer and GNS3 run the same CLI against simulated hardware, which is how most people build the muscle memory before touching a live network.
- Arista and Juniper deliberately kept a Cisco-like CLI, because the number of people who already know these commands is itself a market force.
Passwords, users and getting in remotely
A device with no passwords is a device anyone with a cable owns. The minimum useful configuration protects privileged mode, protects both kinds of login, and replaces Telnet with SSH.
! protect privileged exec — secret is hashed, password is not
ACCESS-SW1(config)# enable secret Str0ng-Enable-Pass
! local user accounts instead of a shared line password
ACCESS-SW1(config)# username sujith privilege 15 secret Str0ng-User-Pass
! console access asks for one of those accounts
ACCESS-SW1(config)# line console 0
ACCESS-SW1(config-line)# login local
ACCESS-SW1(config-line)# exec-timeout 10 0
ACCESS-SW1(config-line)# logging synchronous
ACCESS-SW1(config-line)# exit
! SSH needs a hostname, a domain name and a key
ACCESS-SW1(config)# ip domain-name example.local
ACCESS-SW1(config)# crypto key generate rsa modulus 2048
ACCESS-SW1(config)# ip ssh version 2
ACCESS-SW1(config)# line vty 0 15
ACCESS-SW1(config-line)# login local
ACCESS-SW1(config-line)# transport input ssh
ACCESS-SW1(config-line)# exec-timeout 10 0
ACCESS-SW1(config-line)# endDetails that matter in that block:
enable secretrather thanenable password. The oldpasswordform stores a trivially reversible encoding;secretstores a hash. If both exist,secretwins, which is a hint about which one Cisco wants you to use.transport input ssh. Without it, the vty lines accept Telnet, and Telnet carries the password in clear text across the network.- The key needs a name. RSA key generation fails until both a hostname and a domain name are set, because the key is labelled with
hostname.domain. logging synchronous. Without it, a log message arriving while you type scatters your half-finished command across the screen. With it, IOS reprints your line. It changes nothing functionally and improves every session.exec-timeout 10 0. Ten minutes and zero seconds of idle time before the session closes. The default on some lines is never, which leaves logged-in consoles sitting in wiring cupboards.
One more, worth adding to any device that still has plaintext passwords in its configuration for legacy reasons:
ACCESS-SW1(config)# service password-encryptionThis obscures passwords in show running-config using Cisco's type 7 encoding. Be clear about what it does: type 7 is reversible in a fraction of a second by any of a dozen free tools. It stops shoulder-surfing, and nothing else. Real protection comes from secret, which is hashed.
Privilege levels
IOS has sixteen privilege levels, 0 to 15. Level 1 is user exec, level 15 is privileged exec, and the twelve in between are available for building restricted roles — a level 5 that can run show commands and clear counters but change nothing, for example. In practice most organisations skip this and use AAA with a RADIUS or TACACS+ server instead, because per-device privilege configuration does not scale past a handful of devices.
username bob privilege 15 secret ... puts Bob straight into privileged exec at login, with no enable step. That is convenient for an administrator and an accident waiting to happen for anyone else, because the account bypasses the enable password entirely.
Working faster: help, shortcuts and habits
The CLI has a small set of features that separate a slow session from a quick one.
The question mark
? is context-sensitive help and it works everywhere, including in the middle of a word.
Switch# sh? ! all commands starting with sh
show shell
Switch# show ip ? ! what can follow "show ip"
access-lists arp bgp dhcp interface nat ospf protocols route ...
Switch(config-if)# ip address ?
A.B.C.D IP address
dhcp IP Address negotiated via DHCPUsed properly, this replaces most documentation lookups: you can discover an entire command by typing one word at a time and asking what comes next.
Abbreviation and completion
Any command can be shortened to the point where it is unambiguous. sh ip int br is show ip interface brief, conf t is configure terminal, int gi0/1 is interface GigabitEthernet0/1. Tab completes a partially typed keyword. Ambiguity produces % Ambiguous command, which means add another letter.
| Key | Does |
|---|---|
| Tab | Complete the current keyword |
| Up arrow / Ctrl-P | Previous command from history |
| Ctrl-A / Ctrl-E | Jump to start / end of line |
| Ctrl-Shift-6 | Abort a running ping, traceroute or resolution attempt |
| Ctrl-Z | Return to privileged exec from any config mode |
| Space / Enter | Next page / next line of paged output |
Ctrl-Shift-6 is the one to memorise before you need it. It is the escape from a traceroute to an unreachable address, which otherwise takes several minutes to give up on its own.
Error messages, decoded
| Message | Means |
|---|---|
% Ambiguous command | The abbreviation matches more than one command. Type more letters. |
% Incomplete command | The command is right but needs more arguments. Add ? at the end to see what. |
% Invalid input detected at '^' marker | Something is wrong at the caret — often the right command in the wrong mode. |
The third one is worth pausing on, because the caret is genuinely helpful: it points at the first character IOS could not parse. If it points at the very start of the line, you are in the wrong mode. If it points partway in, that argument is wrong.
Two output habits
terminal length 0 disables the --More-- pager for the current session, which is what you want when copying a full configuration out to a file. And show run | section beats scrolling, every time.
- Configuration backups in most organisations are a scheduled job that logs in, runs
terminal length 0andshow running-config, and commits the output to Git — crude, and better than nothing when a switch dies. - RANCID and Oxidized are the open-source tools built around exactly that idea, diffing configurations nightly so unauthorised changes surface.
- Cisco DNA Center and similar controllers replace the whole workflow with an API, which is where article 16 picks the story up.
- NVRAM
- Non-volatile RAM, where
startup-configlives. Small, and separate from flash, which holds the IOS image. - ROMMON
- The ROM monitor: a minimal prompt the device falls back to when it cannot load an IOS image, and where password recovery is performed.
- vty line
- Virtual teletype: a remote login session. Devices have 5 or 16 of them, and configuring
line vty 0 15covers all. - Configuration register
- A four-hex-digit value that controls boot behaviour.
0x2102is normal;0x2142tells the device to ignorestartup-config, which is how passwords are recovered.
Recap
- The console port works with no configuration at all, at 9600 8N1, and is the only way in when everything else fails.
- Boot order is POST, bootstrap, IOS image from flash, then
startup-configfrom NVRAM. - The prompt says the mode:
>user exec,#privileged exec,(config)#global config, with sub-modes for interfaces, lines and routing processes. exitgoes up one level,endor Ctrl-Z returns to privileged exec, anddoruns a show command from config mode.running-configis live in RAM;startup-configis in NVRAM and only changes when you copy.- Every command takes effect as you type it — there is no apply step, only a save step.
reload in 10before a risky remote change gives you an automatic rollback.- Nearly every configuration line is removed by prefixing it with
no. - A switch's management address goes on a VLAN interface, not on a physical port.
enable secretis hashed andenable passwordis not;service password-encryptiononly stops shoulder-surfing.- SSH needs a hostname, a domain name, an RSA key and
transport input sshon the vty lines. ?, tab completion, abbreviation, Ctrl-Shift-6 andshow run | sectionare the difference between a fast session and a slow one.
Questions
Say the answer out loud before opening it.
What is the difference between running-config and startup-config?
running-config is the live configuration in RAM that every command changes immediately; startup-config is the copy in NVRAM that is loaded at boot.
- Changes take effect instantly but are lost on reload unless copied.
copy running-config startup-config, orwrite memory, makes them permanent.show startup-configshows what will load next time, which may differ from what is running.
The gap between them is also a safety net: reload in 10 before a risky change means a lockout resolves itself when the device reboots into the last saved configuration.
Name the IOS modes and how you move between them.
User exec, privileged exec, global configuration, and sub-modes such as interface, line and router configuration.
enablemoves from user to privileged exec;disablegoes back.configure terminalenters global config; a command likeinterface Gi0/1enters a sub-mode.exitgoes up one level,endor Ctrl-Z returns to privileged exec from any depth.
The prompt suffix is the reliable indicator — >, #, (config)#, (config-if)# — and reading it first explains most "invalid input" errors.
You configure an IP address on a switch port and it does not work. Why?
Because switch ports are layer 2 interfaces with no IP address; management addresses go on a VLAN interface.
interface vlan 1(or whatever the management VLAN is) is where the address belongs.- The VLAN interface must be brought up with
no shutdown, and at least one port in that VLAN must be up. - A switch also needs
ip default-gateway, since it does not route.
On a layer 3 switch you can convert a port with no switchport, at which point it becomes a routed interface and does take an address directly.
What is the difference between enable password and enable secret?
enable password stores the value with a reversible type 7 encoding; enable secret stores a hash that cannot be reversed.
- If both are configured,
enable secrettakes precedence. service password-encryptionapplies type 7 to plaintext passwords, which stops shoulder-surfing and nothing more.- Modern IOS supports stronger hash types for secrets, selected with the
algorithm-typekeyword.
Type 7 strings are decoded instantly by freely available tools, so a configuration file containing them should be treated as containing plaintext passwords.
What are the four things needed before SSH will work on a switch?
A hostname, a domain name, an RSA key pair, and vty lines configured for local login with SSH transport.
- The key is labelled
hostname.domain, so key generation fails if either is missing. crypto key generate rsa modulus 2048creates a key of usable strength.transport input sshon the vty lines refuses Telnet, andlogin localuses the local user accounts.
A management IP address and a default gateway are also required for the session to reach the device at all, which is easy to forget on a switch.
What does "no ip domain-lookup" do and why is it almost always configured?
It stops IOS from treating an unrecognised command as a hostname and attempting to resolve it via DNS.
- Without it, a typo triggers a DNS lookup that hangs the session for up to thirty seconds.
- Ctrl-Shift-6 aborts the attempt, but the annoyance is constant.
- It has no downside on a device that does not need to resolve names itself.
On devices that genuinely need DNS — for NTP names or syslog targets — leave it on and configure a name server instead, accepting the occasional pause.
What does "% Invalid input detected at '^' marker" tell you?
That IOS could not parse the command starting at the character the caret points to.
- A caret at the very beginning usually means the command exists but not in this mode.
- A caret partway in means that argument is wrong — a bad interface name, or a mask where a wildcard belongs.
% Incomplete commandis different: the command is valid but needs more arguments.
Adding ? at the position of the caret lists exactly what IOS expected there, which resolves nearly all of these in one step.
How do you remove a configuration line you no longer want?
Retype it with no in front, in the same mode where it was configured.
no shutdownenables an interface;shutdowndisables it.no ip addressremoves the address from an interface.- For most commands the arguments can be omitted —
no descriptionis enough.
Some commands have to be negated with their full arguments because several instances can coexist, static routes and access list entries being the usual examples.
What does "logging synchronous" do?
It makes IOS reprint your partially typed command after a log message interrupts it.
- Without it, a link going up or down scatters text through whatever you were typing.
- The command is applied per line, so it is configured under
line console 0andline vty 0 15. - It changes nothing about which messages are generated — only how they interleave with your input.
The alternative is to suppress console logging entirely with no logging console, which is common on production devices that send logs to a syslog server anyway.
What is the configuration register and which value matters for password recovery?
A four-hex-digit value controlling boot behaviour; 0x2102 is normal and 0x2142 tells the device to skip startup-config at boot.
- Booting with 0x2142 gives an unconfigured device you can enter without a password.
- You then copy startup-config into running-config, change the password, set the register back to 0x2102 and save.
- The register is shown at the bottom of
show version.
Because this requires console access, physical security of the wiring cupboard is the actual control protecting the device.
How would you find every interface configured with a description containing "Uplink"?
show running-config | include Uplink for the lines themselves, or show interfaces description for a tidy table.
includeprints matching lines,excludeprints everything else.sectionprints the whole configuration block containing a match, which shows the interface name alongside.beginstarts output at the first match and prints everything after.
The filters accept regular expressions, so | include ^interface|description pairs each interface with its description in one pass.
Why use "reload in 10" before a change on a remote device?
Because if the change cuts your own access, the device reboots into the last saved configuration and hands the session back.
- The classic causes are an ACL applied in the wrong direction and a routing change that removes the path you are connected over.
- After verifying the change works,
reload cancelstops the timer. - The change must not be saved until it has been verified, or the reboot restores the broken version.
Newer IOS versions offer configuration archive and configure replace for the same purpose with finer control, but the reload timer works everywhere.
What does a device booting to "rommon 1>" mean?
That it could not load an IOS image and fell back to the ROM monitor.
- Common causes are a deleted or corrupt image in flash, a wrong boot system statement, or a configuration register set to boot into ROMMON.
- From ROMMON you can boot a specific image, or copy one over via TFTP or USB.
- It is a different situation from the setup dialog, which means IOS loaded fine but found no configuration.
ROMMON access requires the console, which is one more reason the console port is never left unpatched in a production rack.
What is a vty line and why configure 0 through 15?
A vty is a virtual terminal line used by a remote login session; configuring 0 through 15 covers all sixteen simultaneous sessions the device supports.
- Settings applied to a subset leave the remaining lines with defaults, which may allow Telnet or no password at all.
- Older platforms have only five (0 through 4), and newer ones sixteen.
- An access class can be applied to the vty lines to restrict which source addresses may connect.
Leaving some lines unconfigured is a real vulnerability, because a connection simply lands on the first free line whatever its number.
Which single show command would you run first on an unfamiliar device, and why?
show ip interface brief, because it shows every interface, its address, and its line and protocol status in one screen.
- "up/up" means the physical link and the protocol are both working.
- "up/down" points at a layer 2 problem such as an encapsulation or keepalive mismatch.
- "administratively down" means somebody typed
shutdown.
Following it with show cdp neighbors gives you the topology around the device, so within two commands you know what it is and what it is connected to.