scp
copy files over SSHscp is cp across the network. A remote path is written user@host:path, and the copy travels inside an SSH connection, so it is encrypted and uses the same keys and passwords as ssh.
The colon is what makes it remote: host:path. Without one, scp copies locally.
At the terminal
Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.
What the numbered lines are telling you
The local file goes to /tmp on the server. The line shows the name, percentage, size, speed and time.
The remote path comes first and the destination is the dot: the current directory.
-r copies site and everything in it, printing a line for each file.
Switches
A switch changes how the command behaves. These are the ones used day to day; man scp lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.
-r- Recursive: copy directories.
-P PORT- Connect to this port. Capital P.
-p- Preserve modification times and modes.
-i FILE- Use this private key.
-C- Compress data in transit.
-q- Quiet: no progress meter.
Variations worth knowing
The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.
scp -P 2222 file deploy@192.0.2.10:Uses another port. A bare colon means the remote home directory.
scp -p file deploy@192.0.2.10:/tmp/Preserves the file’s modification time and mode.
scp host1:/tmp/a.txt host2:/tmp/Copies from one remote machine to another.
rsync -avhP site/ deploy@192.0.2.10:/var/www/site/Better for large or repeated copies: resumes, and sends only changes.
In cybersecurity
scp is the encrypted replacement for FTP and rcp.
FTP sends the password and the file in clear text. scp, sftp and rsync over SSH protect both.
A file uploaded to /tmp is readable by other users on the server unless its mode says otherwise. Copy secrets straight to a private directory.
scp replaces an existing file of the same name silently. Check the destination path, especially with -r.