Displaying the Commands to Recreate a Configuration Problem
You have a copy of a JUNOS router configuration or you need to duplicate a router configuration on another router and you want to know the commands to use to create the configuration.
Use the following command to list the commands for creating a configuration:
# show | display set
The show | display set command is a handy way to reverse-engineer a router configuration when you are trying to duplicate portions of a configuration on many routers or when you need to write up configuration, monitoring, or troubleshooting procedures for your network operations staff. This command is especially useful if the configuration is complex and when setting it up involves many long commands and lots of typing.
When you pipe the output of the configuration mode show command into the display set command, the JUNOS CLI prints a list of the commands you need to issue from that hierarchy level to create the existing configuration. When you use the command at the top level of the configuration (at the  level), the CLI shows all the commands necessary to configure the router, which for most routers is a lot of commands. By way of illustration, here’s a sample of the output for four interfaces on the router from the [edit interfaces] level:
# show interfaces | display set
set interfaces fe-0/0/1 unit 0 family inet address 10.0.15.2/24
set interfaces se-0/0/2 unit 0 family inet address 10.0.21.1/24
set interfaces se-0/0/3 serial-options clocking-mode dce
set interfaces se-0/0/3 unit 0 family inet address 10.0.16.1/24
set interfaces lo0 unit 0 family inet address 192.168.13.1/32
You can cut and paste these commands individually or all at once. They produce the following configuration:
# show interfaces