SCP

Secure CoPy (SCP) is a command-line tool for copying files between two destinations.

Basic usage

To copy from a local machine to a remote machine:

scp /path/on/local user@remote:/path/on/remote

Warning

The colon (:) is required for remote targets. Without it, SCP assumes that you are attempting to copy from local to local, and will make a strangely named file:

you@local (~) ∑ ls
foobar
you@local (~) ∑ scp foobar user@remote
you@local (~) ∑ ls
foobar  user@remote
you@local (~) ∑ 

To copy from a remote machine to a local machine:

scp user@remote:/path/on/remote /path/on/local

Tips and Tricks

Implicit user

If you don't specify a user on the command line, SCP will assume that you intend to authenticate as yourself. If your username on both local and remote is user, this will work to copy from remote to local:

scp remote:/path/on/remote /path/on/local

Passwordless authentication

SCP can use SSH keys to authenticate to the remote machine, making copy commands much easier.