Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: pdf layout

...

The following table shows some SCP syntax examples

TaskCommand
Copy single file to another system$ scp <local-file> <user>@<remote-host>:<remote-file-path>
Copy a directory recursively to another system$ scp -r <local-path> <user>@<remote-host>:<remote-path>
Copy a single file from another system$ scp <user>@<remote-host>:<remote-file-path> <local-file>
Copy a directory recursively from another system$ scp -r <user>@<remote-host>:<remote-path> <local-path>


The following example shows how a small directory tree is copied to a user account named charon from another system:


Div

$ scp -r ./Tmp charon@192.168.2.107:

charon@192.168.2.107's password:

file4.txt  100%    0     0.0KB/s   00:00   

file3.txt  100%    0     0.0KB/s   00:00   

file1.txt  100%    0     0.0KB/s   00:00   

file2.txt  100%    0     0.0KB/s   00:00


Transferring Files with SFTP

...

The following example shows how a directory structure is recursively copied from the guest system (IP address 192.168.2.107 in the example) by another system:


Div
classcommandline

$ sftp charon@192.168.2.107

charon@192.168.2.107's password:

Connected to 192.168.2.107.

sftp> ls Tmp

Tmp/A  Tmp/B  Tmp/C 

sftp>

sftp> get -r Tmp/

Fetching /home/charon/Tmp/ to Tmp

Retrieving /home/charon/Tmp

Retrieving /home/charon/Tmp/B

Retrieving /home/charon/Tmp/B/b

Retrieving /home/charon/Tmp/B/a

Retrieving /home/charon/Tmp/A

Retrieving /home/charon/Tmp/A/b

Retrieving /home/charon/Tmp/A/a

Retrieving /home/charon/Tmp/C

sftp>

sftp> bye


Using General Backup and Restore Commands

...

The following example shows how to use fbackup/frecover through ssh to copy files between two HP-UX systems:

On the source system:

# fbackup -i <source-path> -f - | ssh <remote-user>@<target-ip> "(cd <destination-dir>; frecover -r -f -)"


The following example shows how to use pax through ssh to copy files between two HP-UX systems or between an HP-UX system and, for example, a Linux system:

On the source system:

# pax -w <source-path> | ssh <remote-user>@<target-ip> "(cd <destination-dir>; pax -v -r -pe)"


(warning) Take care not to overwrite any files on the target system! Please read the respective man-pages carefully to learn about additional parameters of the commands and their proper use.

...