SCP is a method of securely transferring files between a local host and a remote host or between two remote hosts.
Example: Copying a file from a local machine to a remote server.
Format:
[username@]<computer>:<path>
Username: If not specified, your local username is used.
Computer: Can be a hostname (e.g.,
computer.cornell.edu
) or an IP address.Colon (
:
): Indicates a remote location.Path: If not specified, the remote user’s home directory is used.
Examples:
Copying a file to a remote server
scp /path/to/local/file username@remote_host:/path/to/remote/directory/
“directory” must exist on the remote computer
Paths beginning with “/” are absolute, others are relative to home directory
To recursively copy a directory to a remote computer:
scp –r directory scu-login02.med.cornell.edu:–
The “-r” option specifies the recursive copy
If “directory” doesn’t exist on the remote, it will be created
If it does exist, just the contents will be copied