What You Need to Know about Junos Command Hierarchy - dummies

What You Need to Know about Junos Command Hierarchy

By Walter J. Goralski, Cathy Gadecki, Michael Bushong

All the Junos OS commands are split between operational and configuration mode. Yet, each mode still has hundreds of possible commands. If the command line interface (CLI) showed them all in a single list, it would fill many screens and be difficult to use. So the Junos OS software arranges them into hierarchies that group together related commands.

Among the most commonly used of the operational hierarchies are the show and clear commands. You use the show command to display status and statistics for just about everything on the device, from the network interfaces (show interfaces) to the hardware (show chassis hardware) to the routing protocols (show ospf, show bgp, and so on). You use the clear command to clear, or zero, statistics collected by the device.

In the hierarchies under the clear and show commands of the operational mode, both top-level commands have bgp, interfaces, and system commands. Then the next level down has different options in the hierarchies. From these hierarchies, some of the commands available are clear bgp neighbor neighbor-name, show bgp neighbor neighbor-name, and show interfaces.


When you first log in to the device, you are in operational mode. By typing a ? at the command prompt, you can view a list of all the top-level operational commands for your device. A subset of the operational mode command hierarchy, where the command name is on the left and a description is on the right, follows:

wiley@netnik> ?
Possible completions:
 clear                Clear information in the system
 configure            Manipulate software configuration information
 file                 Perform file operations
 help                 Provide help information
 monitor              Show real-time debugging information
 ping                 Ping remote target
 quit                 Exit the management session
 request              Make system-level requests
 restart              Restart software process
 set                  Set CLI properties, date/time, craft interface message
 show                 Show system information
 ssh                  Start secure shell on another host
 telnet               Telnet to another host
 traceroute           Trace route to remote host

If you have experience using Cisco IOS software, know that Junos does not use the keyword IP in its commands. Many of the operations commands are otherwise the same. For example, the IOS command show ip route becomes show route in Junos.

If you peek under each command, you see the next level in the hierarchy. For example, this is a truncated list of the different varieties of the show commands.

wiley@netnik> show ?
Possible completions:
  accounting           Show accounting profiles and records
  aps                  Show Automatic Protection Switching information
  arp                  Show system Address Resolution Protocol table entries
  as-path              Show table of known autonomous system paths
  bfd                  Show Bidirectional Forwarding Detection information
  bgp                  Show Border Gateway Protocol information
  chassis              Show chassis information
  class-of-service     Show class-of-service (CoS) information
  cli                  Show command-line interface settings
  configuration        Show current configuration

Using ? allows you to see the subordinate commands in the next level of the hierarchy. Drill down one more level of the hierarchy, into the show chassis hierarchy, and you see

wiley@netnik> show chassis ?
Possible completions:
  alarms               Show alarm status
  environment          Show component status, temperature, cooling system speeds
  firmware             Show firmware and operating system version for components
  fpc                  Show Flexible PIC Concentrator status
  hardware             Show installed hardware components
  location             Show physical location of chassis
  mac-addresses        Show media access control addresses
  pic                  Show Physical Interface Card state, type, and uptime
  routing-engine       Show Routing Engine status

The hierarchy for a command ends when you see Enter as one of the possible command completions.

wiley@netnik> show chassis hardware ?
Possible completions:
  <[Enter]>            Execute this command
  detail               Include RAM and disk information in output
  extensive            Display ID EEPROM information
  models               Display serial number and model number for orderable FRUs
  |                    Pipe through a command

So, when you finally reach the end of the hierarchy, press Enter to see output data.

wiley@netnik> show chassis hardware 
Hardware inventory:
Item             Version  Part number  Serial number  Description
Chassis                                25708             M20
Backplane        REV 03   710-002334   BB9738            M20 Backplane
Power Supply A   REV 06   740-001465   005234            AC Power Supply
Display          REV 04   710-001519   BA4681            M20 FPM Board
Routing Engine 0 REV 06   740-003239   1000224893        RE-2.0
Routing Engine 1 REV 06   740-003239   9000022146        RE-2.0
SSB 0            REV 02   710-001951   AZ8112            Internet Processor IIv1
SSB 1            N/A      N/A          N/A               Backup
FPC 0            REV 03   710-003308   BD8455            E-FPC
  PIC 0          REV 08   750-002303   AZ5310            4x F/E, 100 BASE-TX
  PIC 1          REV 07   750-004745   BC9368            2x CT3-NxDS0
  PIC 2          REV 03   750-002965   HC9279            4x CT3
Fan Tray 0                                               Front Upper Fan Tray
Fan Tray 1                                               Front Middle Fan Tray
Fan Tray 2                                               Front Bottom Fan Tray
Fan Tray 3                                               Rear Fan Tray

The output of the show commands in operational mode is different from the output of the show commands in configuration mode. Operational mode has a large group of show commands to display status and statistics for just about everything on the device. In configuration mode the command outputs a listing of the candidate configuration.