Go to main content

Managing Remote Systems in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020
 
 

How to Copy Files From a Remote System (sftp)

  1. Establish an sftp connection.

    See How to Open and Close an sftp Connection to a Remote System.

  2. (Optional) Change to a directory on the local system where you want the files copied to.
    sftp> lcd target-directory
  3. Change to the source directory.
    sftp> cd source-directory
  4. Ensure that you have read permission for the source files.
    sftp> ls -l
  5. To copy a file, use the get command.

    Metacharacters may be used with the get command.

    sftp> get filename 
  6. Close the sftp connection.
    sftp> bye
Example 5  Copying a File From a Remote System (sftp)

In this example, the user opens an sftp connection to the system host1, and uses the get command to copy a single file from the /tmp directory.

$ sftp host1
Connecting to host1...
Password: xxx
sftp> lcd /tmp
sftp> cd /tmp
sftp> ls
filea
files
ps_data
sftp> get filea
/tmp/filea                                100%  494     0.5KB/s   00:00
sftp> bye