Get to Know the Question Mark

Previously, I said that you can get the available commands by typing ? at the prompt. You can also use this trick to find the subcommands of any command. For example, if you know you want to use the copy command but cannot remember which subcommand you need, type:

Router#copy ?
  WORD            Copy from flash device - format <dev:>[partition:][filename]
  flash           Copy from system flash
  flh-log         Copy FLH log file to server
  mop             Copy from a MOP server
  rcp             Copy from an rcp server
  running-config  Copy from current system configuration
  startup-config  Copy from startup configuration
  tftp            Copy from a TFTP server

Another use of the question mark is to find all commands that match what you have typed so far. For example, if you know the first part of a command, type it and then type a question mark. The router will return a list of all the matching commands. In the following example, we remember that the configure command begins with “co”, but that’s it. The router gives us the matching commands:

Router#co?        
configure  connect  copy

Note the important difference between these two examples. In the first example, there was a space before the question mark, which gave us the next command that complements copy. Had there not been a space, the router would have tried to complete the word “copy” for us, not given us the next available commands. In the next example, we did not add the space, so the router tried to complete “co” with all the commands it could find that start with “co”.

Another important rule to understand is that the router will return only commands that are relevant to the mode you are currently in. For example, if you are in user mode, you will be given only commands that apply to that mode.

Get CISCO IOS in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.