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
. Another
shortcut is to press Tab after typing “conf”; the router
will fill in the best completion, which is “configure”.
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 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.
Another form of command-line completion is the use of the Tab key. If you start a command by entering the first few characters, you can hit the Tab key. As long as there is only one match, the router will complete the command: for example, if you type “sh” and hit Tab, the router completes the “sh” with “show”. If the router does not complete the command, you can enter a few more letters and try again.
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.