Do I have to memorize all the commands?

There are many commands for Cisco devices. For example, the hostname command to name a host, the ip address command to set an IP address for an interface, the enable secret command to set a password, and so on. It’s hard to remember all these many commands. Even if you can remember the general syntax, it is difficult to remember the details completely.

That’s why you can use “help” and “completion”, which are useful features of command input.

Command Help

For help, type [?] from the command line. from the command line. The help tells you what commands start with a letter and what commands you can enter next. For example, if you want to know what commands begin with the letter “e” in user EXEC mode, type “?” after the letter “e” like this. after the “e” as shown below.

Router>e?
enable  exit

Router>e

You will see that there are two commands starting with “e” in user EXEC mode: “enable” and “exit”.

Also, commands often have a set of parameters following them. The help will tell you what parameters you should specify. As an example, to see what parameters can be entered after enable, you can type enable followed by a space and a [?] to see what parameters you can enter after enable, like this

Router>enable ?
  <0-15>  Enable level
  view    Set into the existing view
  

Router>enable

You can see that there are three cases of enable followed by a number between 0 and 15, a view, or a . The is the [Enter] key, which means that it is recognized as a command and can be executed at this point.

Command Completion

Next, let’s talk about command completion. You can use the [TAB] key to complete a command. Some commands are very long. It’s not easy to remember all the long commands, and you might make typing mistakes. So, if you type part of a command and press the [TAB] key, it completes the rest of the command. However, you have to enter even the part of the command that uniquely identifies it.

or example, in the previous help example, there are two commands that begin with the letter “e”, but simply pressing the [TAB] key after the letter “e” does not work. Simply typing “e” and then pressing the [TAB] key does not complete the command, but completes it automatically as “enable”.

Note that you don’t have to complete the command, but you can type the command to the point where you can uniquely identify it and press the [Enter] key to recognize it. In other words, enable+[Enter] and en+[Enter] are the same thing. You don’t have to spell the command in full; you can use the abbreviated form.

As an example, consider the following CLI mode transition.

  • From User EXEC mode to Privileged EXEC mode
  • From Privileged EXEC mode to Global configuration mode
  • From Global configuration mode to FastEthernet0/0 interface configuration mode

In these CLI mode transitions, when the command is entered in full spelling or in abbreviated form, it looks like this

full spelling

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

abbreviated

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#

Using abbreviations reduces the possibility of typing mistakes. Using abbreviations and the [TAB] key complementary function is the key to reducing the chance of typing mistakes as much as possible.

Command History and Extended Editing Commands

The IOS CLI stores the commands you enter in the command history so that you can easily recall the commands you have previously entered.

To recall the last command you entered, press [↑] or [Ctrl]+[p] on the keyboard to cycle from the most recent command to the most recent one. You can also press [up] or [Ctrl]+[n] to go back to the previous command, or press [down] or [Ctrl]+[n] to go back to the previous command. To display the commands stored in the command history, type the show history command in privileged EXEC mode.

Router#show history
  en
  ping 1.1.1.1
  telnet 1.1.1.1
  terminal history size 15
  traceroute 1.1.1.1
  show history

Also, the default number of commands stored in the command history is 10. If you want to change the number of commands to be stored, enter the following commands

#terminal history size <number>

<number> : Number of command history 0-256

To reset the number of command history to the default of 10, type terminal no history size.

There are other extended editing commands to support CLI command input other than [↑] or [Ctrl]+[p] and [↓] or [Ctrl]+[n]. The main extended editing commands are summarized in the following table.

Extended Editing Commandsbehavior
[Ctrl]+[A]Move the cursor to the top of the command line.
[Ctrl]+[E]Move the cursor to the end of the command line
[Ctrl]+[F]または[→]Move the cursor one character to the right.
[Ctrl]+[B]または[←]Move the cursor one character to the left.
[ESC]+[F]Move the cursor one word to the right.
[ESC]+[B]Move the cursor one word to the left.
[Ctrl]+[D]Delete one character to the right of the cursor.
[Backspace]または[Ctrl]+[H]Delete one character to the left of the cursor.

Related articles