How To

Cisco IOS CLI Editing Commands and Navigation Shortcuts

Most of the time you spend on a Cisco router or switch is spent typing in the IOS command-line interface, and a handful of modes, shortcuts, and help commands decide whether that time is fast or frustrating. This guide covers how to move between the command modes, how to make the device tell you what it expects with the question mark, the keyboard shortcuts that edit the line without retyping it, and how to recall commands you already ran.

Original content from computingforgeeks.com - post 135

None of this is exotic, but it is the difference between hunting for a command and abbreviating it in two keystrokes. Every prompt and output block below was captured on Cisco IOS 15.2 in a GNS3 lab in June 2026. The same keys work in Packet Tracer and on real Catalyst and ISR hardware, because the IOS CLI behaves the same everywhere.

Cisco IOS command modes

The CLI is split into modes, and the prompt tells you which one you are in. You land in user EXEC (>), move up to privileged EXEC (#) with enable, drop into global configuration ((config)#) with configure terminal, and from there into sub-modes for an interface, a routing process, or a line. Walking down and back up looks like this:

R1> enable
R1# configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)# interface GigabitEthernet0/0
R1(config-if)# exit
R1(config)# end
R1#

exit moves up one mode; end (or Ctrl-Z) jumps straight back to privileged EXEC from anywhere in configuration. Knowing which mode a command belongs to saves most “% Invalid input” errors, because a command typed in the wrong mode does not exist there.

Context-sensitive help with the question mark

The ? is the single most useful key on the device. Typed on its own, it lists every command available in the current mode. Typed against a partial word, it lists the commands that complete it. Typed after a command, it lists that command’s next argument. Start with word completion: which commands begin with co?

R1# co?
configure  connect  connectedapps  copy

Put a space before the ? and IOS shows what the command expects next instead. Here it tells you that clock set wants a time in hh:mm:ss format:

R1# clock set ?
  hh:mm:ss  Current Time

The mode changes and both styles of help look like this in a live session on the router:

Cisco IOS CLI showing command mode transitions and question-mark context help on R1

That distinction matters: co? with no space completes the word, while clock set ? with a space asks for the next argument. Used well, the question mark means you rarely have to remember exact syntax, you ask the device for it.

Keyboard shortcuts for editing the command line

IOS uses Emacs-style line editing. Once a long command is on the line, these shortcuts move and edit without arrow-key mashing or retyping. They work in every mode.

ShortcutWhat it does
Ctrl-AJump to the beginning of the line
Ctrl-EJump to the end of the line
Ctrl-B / Left arrowMove back one character
Ctrl-F / Right arrowMove forward one character
Esc-BMove back one word
Esc-FMove forward one word
Ctrl-DDelete the character at the cursor
BackspaceDelete the character to the left
Ctrl-WDelete the word to the left of the cursor
Ctrl-UErase the entire line
Ctrl-RRedisplay the line (after a log message scrolls it)
Ctrl-ZLeave configuration mode for privileged EXEC

Ctrl-A then edit, or Ctrl-W to drop the last word, turns a mistyped 80-character ACL line into a quick fix instead of a full retype. Ctrl-R is the one people miss: when a %LINK-3-UPDOWN log message prints in the middle of what you were typing, Ctrl-R reprints your line cleanly so you can finish it.

Recall previous commands with history

The CLI keeps a history buffer of recent commands. Ctrl-P (or the up arrow) steps back through it, Ctrl-N (or the down arrow) steps forward. To see the buffer, run show history:

R1# show history
  terminal length 0
  configure terminal
  clock set
  co
  show history

The buffer holds the last 10 commands by default. On a session where you are repeating long commands, raise it for the current terminal:

terminal history size 50

The maximum is 256. That setting applies to your current session only, so a fresh login starts back at the default. To make a larger buffer stick across logins, set history size 50 under line console 0 or line vty 0 4 instead.

Tab completion and command abbreviation

Tab completes the current keyword once you have typed enough to make it unique. Type conf and press Tab and IOS fills in configure. You do not even have to complete words: IOS accepts any abbreviation that is unambiguous, so conf t runs configure terminal, sh ip int br runs show ip interface brief, and wr runs write. If an abbreviation is ambiguous, the device says % Ambiguous command and you add a letter until it is not.

Filter long output with a pipe

Some show commands run to hundreds of lines. A pipe trims them to what you need: include keeps matching lines, exclude drops them, section keeps a whole config block, and begin starts the output at the first match. To see only the interfaces that are up, pipe through include:

show ip interface brief | include up

Only the line carrying “up” comes back, instead of every interface on the device:

GigabitEthernet0/0     192.168.10.1    YES manual up                    up

The same works on the running config. show running-config | section line vty prints just the VTY block, and show running-config | begin interface jumps the output to the first interface. On a busy device that is the difference between scrolling and finding.

Run show commands from config mode with do

You often need to check something while you are deep in configuration mode, and leaving to run a show command then navigating back is wasteful. The do prefix runs any privileged EXEC command without leaving config mode. From inside (config)#:

do show ip interface brief | include up

It returns the EXEC output inline and leaves you exactly where you were:

GigabitEthernet0/0     192.168.10.1    YES manual up                    up

Without do, that same command inside config mode returns “% Invalid input”, because show commands belong to EXEC. The do prefix is the bridge, and it works with the pipe filters above.

This is where the SSH configuration and base device setup guides get faster: every command in them abbreviates, and the question mark fills in the parts you do not remember. If you want a lab to practice in, the GNS3 install guide sets one up, and this CLI fluency maps to the device-management basics in the CCNA 200-301 study guide.

None of these shortcuts are graded on the exam, but they are muscle memory for anyone who works on Cisco gear daily. Spend an hour in a lab driving the CLI with ?, Tab, and Ctrl-A through Ctrl-W, and retyping commands stops being part of the job.

Practice the Cisco IOS CLI

Turn these shortcuts into muscle memory. Flip through the cards to lock in the command modes, the question-mark help, and the editing keys, then take the quiz to check the details that are easy to mix up.

Loading flashcards...
Loading quiz...

Keep reading

Configure Samba File Share on Debian 13 / 12 Debian Configure Samba File Share on Debian 13 / 12 Setup WireGuard VPN on Ubuntu 24.04 / Debian 13 / Rocky Linux 10 Debian Setup WireGuard VPN on Ubuntu 24.04 / Debian 13 / Rocky Linux 10 Use NetworkManager nmcli on Ubuntu and Debian Debian Use NetworkManager nmcli on Ubuntu and Debian Cisco Wireless Architectures and AP Modes Explained Networking Cisco Wireless Architectures and AP Modes Explained Configure EtherChannel (LACP) on Cisco Switches Networking Configure EtherChannel (LACP) on Cisco Switches Add Secondary IP Address on Ubuntu 24.04|22.04|20.04 Networking Add Secondary IP Address on Ubuntu 24.04|22.04|20.04

Leave a Comment

Press ESC to close