scp

scp, or Secure Copy, is used to securely transfer files based on the Secure Shell protocol (ssh). Unlike cp, scp can transfer files from or to a remote host.

Syntax / Example
$ scp source user@host:destination
$ scp user@host:source destination
Basic Example (Local -> remote)
$ scp ~/Desktop/file uniqname@login-course-2fa.engin.umich.edu:~/Documents/

Useful Options / Examples

scp -r

$ scp -r ~/Documents/eecs280p2/ uniqname@login-course-2fa.engin.umich.edu:~/Documents/eecs280p2/

The -r option asks scp to recursively copy an entire directory, copying the directory itself along with all of its contents.

Optional Preliminary Steps

ssh alias

$ scp source alias:destination
$ scp alias:source destination
The following replaces the first example:
$ scp ~/Desktop/file caen:~/Documents/

If you’re going to be typing a remote host multiple times, one of the first things you should do is create an alias (e.g. caen). This is achieved simply by adding a few lines to ~/.ssh/config, as shown in the example below.

Host caen
	Hostname uniqname@login-course-2fa.engin.umich.edu
	User uniqname