Command-Line Completion

Command-line completion makes the IOS interface much more user-friendly. It saves you extra typing and helps out when you cannot remember a command's syntax. In a previous example, we used the command configure terminal:

Router#configure terminal

But you could have saved wear and tear on your hands by typing:

Router#conf t

IOS expands the command conf t to configure terminal, completing the command for you. It may seem like extra work to learn these short versions of the commands, but doing so really pays off, especially for the commands you use frequently. But if you haven't learned the shortcut, you can try pressing Tab. In this case, you could have pressed Tab after typing conf; the router fills in the best completion, which is configure. If you press Tab and the router doesn't fill in the rest of the command, type a few more letters and press Tab again.

Here is another example:

Router#show running-config

This long command can be shortened to:

Router#sh ru

The router knows that show is what you wanted, because show is the only command that begins with "sh"; likewise, the only subcommand of show that begins with "ru" is running-config.

If the router does not understand a command, it repeats the entire command line and places a caret (^) under the point at which it ran into trouble. For example:

Router>show itnerface e0 >show itnerface e0 ^ % Invalid input detected at '^' marker.

The caret symbol is pointing to the "t" in "itnerface", which is the command the router does not understand. We can quickly fix that by retyping the command:

Router>show interface e0

We now get the correct output! Since we also know how to use shortcuts, we can type:

Router>sh int e0

With this command we get the same result as with its lengthy counterpart. Command-line completion saves a lot of typing, and it helps you keep your sanity when you're working with long commands.

Категории