SCP tutorial

From athena

How to use SCP for File Transfers

Uses: Using SCP for file transfers is very useful for not only moving files within your computer to different directories but is also useful to send and receive files over a secure network.

Copying Files Within Your Computer (Locally)
1. First, choose the file you want to move and where you want to move it to.
2. Then use the command "scp", followed by the file which you want to move, followed by the destination of the file you want to move it to.
EXAMPLE: The command will look something like this "scp /tmp/practice /home/tvo/" where I wanted to copy the file "practice" which was in the tmp directory to the directory /tvo, which is a sub-directory of /home

Copying Files Over a Network
1. First choose the file you want to move and what remote network you want to move it to. SCP uses the ssh program and so it will prompt you for the password or passphrase you need to access the remote computer.
2. Then use the command "scp" again, followed by the file you want to move, followed by the username@host... you want to send it to, as well as the file directory on the remote computer you want to save it in.
EXAMPLE: "scp /tmp/practice tvo88@subaru.phys.washington.edu://phys/users/tvo88" Here I wanted to send the file "practice" which was in the file directory "/tmp" to the remote computer "tvo88@subaru.phys.washington.edu" (don't forget the colon!) and in that remote computer I sent the "practice" file to the directory phys/users/tvo88.

Retrieving Files Over a Network
1. Locate the file which you want to retrieve on the remote computer (you can do this by ssh-ing into the remote and looking up the files with ls -a )
2. This is similar to the sending of files over the network except the syntax is backwards. You use the command "scp" and then the remote computer you want to take the files from as well as the file directory on that remote computer followed by the directory on your local computer that you want to send the file to.
EXAMPLE: "scp tvo88@subaru.phys.washington.edu://phys/users/tvo88/practice /tmp" Here we took the file "practice" which is in the directory /phys/users/tvo88/ which is on the remote computer tvo88@subaru.phys.washington.edu and we transfered it to the local directory on our computer called /temp.