You are on page 1of 13

Introduction to the Junos OS

The Junos CLI


Robert Juric
robertjuric.com
@robertjuric

The Command Line Interface


3 Modes
Kernel shell
Operational mode
Configuration mode

Options for help


Filtering command outputs
Moving around the command line

Operational Mode

Show/monitor
commands

> Prompt

Clear counters
or tables

Request
commands

File system
operations

Ping,
Traceroute

Configuration Mode

Set and
Delete
commands

# Prompt

[edit] reflects
hierarchy

Run
operational
commands

Show to view
configuration

Exit or Quit

Help Options

Help

Question Mark

Command usage help topic


Command descriptions help reference
Tip of the day help tip cli

Ambiguous command options


Command completion options
User-created variables

Auto Complete

Tab will autocomplete user


created variables

Space or Tab
Completion

Possible to disable
Space complete in
CLI options

Pipe Commands
Allow filtering of command output
Useful pipe commands:

Command

Description

Find

Begins output at first match

Match

Only displays matching lines

Except

Displays lines excluding matching lines

Count

Returns count of lines

No-more

Displays output without page breaks

Save

Saves output to local file

Pipe Commands
Stack pipe commands for logical AND operation
Show log messages | match fail | match PFE
Only displays failures concerning the PFE
Show interfaces terse | except down | count
Gives count of up interfaces

Wrap pipe command for logical OR operation


Show log messages | match (snmp|management)
Displays log messages which match snmp or management

Emacs Keystrokes
Useful for quick movement around the command line
Helpful keystrokes:
Keystroke

Description

Ctrl+x

Clears entire line

Ctrl+w

Backspace single word

Ctrl+k

Delete from cursor forward

Ctrl+a

Move to beginning of line

Ctrl+e

Move to end of line

Summary
Operational vs. configuration mode
Run command in configuration mode
When you get stuck:
help
Question mark
Autocomplete

Find what youre looking for with pipe commands


Emacs keystrokes to speed things up