Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    file copy

    Syntax

    file copy source destination <source-address address>

    Release Information

    Command introduced before Junos OS Release 7.4.

    source-address option added in Junos OS Release 7.4.

    Command introduced in Junos OS Release 9.0 for EX Series switches.

    Command introduced in Junos OS Release 11.1 for QFX Series switches.

    Description

    Copy files from one location to another location on the local device or to a location on a remote device reachable by the local device.

    Required Privilege Level

    maintenance

    List of Sample Output

    Copy a File from the Local Device to a Personal Computer
    Copy a Configuration File between Routing Engines
    Copy a Log File between Routing Engines
    Copy a File from a TX Matrix Plus Router to a T1600 Router Connected to the TX Matrix Plus
    Copy a File Using File Transfer Protocol
    Copy a File Using File Transfer Protocol and Requiring a Password
    Copy a File Using Secure Copy Protocol (scp)

    Sample Output

    The following are examples of a variety of file copy scenarios.

    Copy a File from the Local Device to a Personal Computer

    user@host> file copy /var/tmp/rpd.core.4 mypc:/c/junipero/tmp
    ...transferring.file...... |          0 KB |   0.3 kB/s | ETA: 00:00:00 | 100%
    

    Copy a Configuration File between Routing Engines

    The following sample command copies a configuration file from Routing Engine 0 to Routing Engine 1:

    user@host> file copy /config/juniper.conf re1:/var/tmp/copied-juniper.conf

    Copy a Log File between Routing Engines

    The following sample command copies a log file from Routing Engine 0 to Routing Engine 1:

    user@host> file copy lcc0-re0:/var/log/chassisd lcc0-re1:/var/tmp

    Copy a File from a TX Matrix Plus Router to a T1600 Router Connected to the TX Matrix Plus

    The following sample command copies a text file from Routing Engine 1 on the switch-fabric chassis sfc0 to Routing Engine 1 on the line-card chassis lcc0:

    user@host> file copy sfc0-re1:/tmp/sample.txt lcc0-re1:/var/tmp

    Copy a File Using File Transfer Protocol

    To use anonymous FTP to copy a local file to a remote system, enter the following command:

    user@host>file copy filename ftp://hostname/filename

    In the following example, /config/juniper.conf is the local file and hostname is the FTP server:

    user@host> file copy /config/juniper.confftp://hostname/juniper.conf
    Receiving ftp: //hostname/juniper.conf (2198 bytes): 100% 
    2198 bytes transferred in 0.0 seconds (2.69 MBps)

    Copy a File Using File Transfer Protocol and Requiring a Password

    To use FTP where you require more privacy and are prompted for a password, enter the following command:

    root@host> file copy filename ftp://user@hostname/filename

    In the following example, /config/juniper.conf is the local file and hostname is the FTP server:

    root@host> file copy /config/juniper.conf ftp://user@hostname/juniper.conf
    Password for user@hostname: ******
    Receiving ftp: //user@hostname/juniper.conf (2198 bytes): 100%
    2198 bytes transferred in 0.0 seconds (2.69 MBps)

    Copy a File Using Secure Copy Protocol (scp)

    To use scp to copy a local file to a remote system, enter the following command:

    root@host> file copy filename scp://user@hostname/path/filename

    In the following example, /config/juniper.conf is the local file, user is the username, and ssh-host is the scp server:

    root@host> file copy /config/juniper.conf scp://user@ssh-host/tmp/juniper.conf
    user@ssh-host's password: ******
    juniper.conf         100% |*********************************************************************************|  2198       00:00

    Published: 2014-04-23