How to Use Junos Command Completion and Keyboard Sequence - dummies

How to Use Junos Command Completion and Keyboard Sequence

By Walter J. Goralski, Cathy Gadecki, Michael Bushong

Many Junos administrators prefer using the command-line interface (CLI) rather than a graphical user interface (GUI) because the CLI generally makes configuring and managing the device quicker for configurations with a lot of customized settings. The downside of using a CLI is that sometimes you have to type long commands or statements. Junos provides two types of shortcuts to minimize typing: command completion and keyboard sequences.

Use Junos command completion

Command completion is just what the name implies: You type the first few characters of a command or statement, press the spacebar or the Tab key, and Junos completes the word.

You can use either the spacebar or Tab key to complete most command arguments, but only the Tab key completes user-defined variables (such as a firewall filter name).

For example, you can use the show interfaces command, which displays the existing configuration for interfaces. With command completion, you can simply type the following:

wiley@netnik# show int<spacebar>

Junos completes the command, and you see the entire command in the CLI:

wiley@netnik# show interfaces

If the portion of the command string you’re entering is ambiguous, Junos will list the possible options:

wiley@netnik# show i<spacebar>
‘i’ is ambiguous
Possible completions:
igmp Show Internet Group Management Protocol
ike Show Interface Key Exchange Information
interfaces Show Interface Information
ipsec Show IP Security Information
isis Show Intermediate System-to Intermediate

So, type an n and press the Enter key to complete:

wiley@netnik# show in<spacebar>
wiley@netnik# show interfaces

Common abbreviations from other operating systems, such as sh int, are available in JUNOS Software. For example:

mike@juniper1> sh<space> int<enter>.

Use Junos keyboard sequences

Use the arrow keys or combine a letter with the Ctrl or Esc key for time saving shortcuts. For example, use the arrow keys to scroll through the recent command history to reuse commands, either as you previously typed them or you may modify them. Table 2-1 lists common keyboard shortcuts for the Junos operating system.

Keyboard sequences are particularly useful when you’re configuring similar items on the device — for example, numerous interfaces of the same type. Keyboard sequences are also useful when you’re debugging a problem on the network and need to reuse the same commands repeatedly.

Keyboard Sequence Action
Up arrow (or Ctrl+P) and down arrow (or Ctrl+N) Move backward and forward through the most recently executed
Left arrow (or Ctrl+B) and right arrow (or Ctrl+F) Move the cursor, character by character, through the text on
the command line.
Esc+B Move back one word.
Esc+F Move forward one word.
Ctrl+A Move to beginning of command line.
Ctrl+E Move to end of command line.
Ctrl+K Delete all text from cursor to end of command line.
Esc+D Delete the word after the cursor.
Esc+Backspace Delete the word before the cursor.
Ctrl+Y Paste the deleted text at the cursor.

Get help with Junos technical documentation

The question mark (?) is always ready and waiting to help you. You can enter a ? at any prompt, or even within commands, to find the possible valid command entries or command completions at that particular point.

For example, entering help? at the top of configuration mode, provides a listing of available help commands. These help commands provide access to the Junos technical documentation directly from the command-line interface. Juniper loads the documentation on new devices and also includes it as a part of upgrade builds.

wiley@netnik# help ?
Possible completions:
 <[Enter]>      Execute this command
 Apropos       Find help information about a topic
 reference      Reference material
 syslog        System log error messages
 tip         Tip for the day
 topic        Help for high level topics
 |          Pipe through a command

The help commands are available in both operational and configuration modes. For example, under this command in configuration mode, you can use the help topic command to provide usage guidelines and the help reference command to lookup command syntax descriptions for configuration statements.