Junos commands you might not aware of

So there is a Junos commands you might not aware of which can make your dealing with configuring a Junos device much easy and simple ! Lets take a look at some of them !

  • ‘rename’ command:

lab@ex-1# rename ge-0/0/6 unit 1 to unit 0

while configuring a switch , accidentally you configure unit 1 to an interface and you cannot commit the configuration because there no such a unit 1 with layer 2 interfaces on EX series switches . So instead of rolling back / deleting wrong configuration , you can simply rename the configuration to the correct one .

  • ‘wildcard’ command:

[edit interfaces]

lab@ex-1# wildcard delete ge-*

matched: ge-0/0/6

matched: ge-0/0/7

matched: ge-0/0/8

delete 3 objects? [yes,no] (no) yes

if you need to delete a lot of line that having something in common , like deleting gig interfaces , you can simply use the ‘wildcard’ command

  • pipe match pipe filter command

user@switch> show interfaces terse | match “interface|0/6|0/7″

Interface Admin Link Proto Local Remote
ge-0/0/6 up down
ge-0/0/6.0 up down eth-switch
ge-0/0/7 up up
ge-0/0/7.0 up up eth-switch

showing multiple matching outputs .

  • ‘copy’ commad

[edit interfaces]

# copy ge-0/0/6 to ge-0/0/7

The copy command duplicates an interface including any child statements such as description.

  • ‘replace’ commad

# replace pattern lopbck with loopback

Make global changes to text patterns in the configuration. For example, if you consistently misspell a word common to the description statement for all of the interfaces on your device, you can fix this mistake with a single command.

  • ‘insert’ command

[edit security policies]
# insert from-zone trust to-zone untrust policy 1 before policy 2

You can use the insert (before/after) to re-order policies instead of deleting and configuring again .

  • ‘refresh’ command

admin@FW> show chassis routing-engine | match Idle | refresh 5                                                         
—(refreshed at 2017-05-03 12:12:24 IDT)—
Idle                      14 percent
Idle                      74 percent
—(refreshed at 2017-05-03 12:12:29 IDT)—
Idle                      14 percent
Idle                      74 percent
—(*more 100%)—[abort]

This command will refresh the output ecery <n> seconds .

Advertisements