scp is used to transfer files from one machine to another.
scp stands for Secure CoPy, and provides the same security as
ssh (i.e., all traffic between hosts is encrypted).
To transfer a file called
myprog.py from the computer you are on (maybe your laptop?) to another computer called
scp myprog.py oil.cs.swarthmore.edu:.
Note the trailing dot (.) at the end of that command. That says "name the copied file the same name (myprog.py) on the other computer.
Note also, the above will try to log you in on
oil.cs.swarthmore.edu as the same user on the current computer.
So if you have username
harry on the current computer, and username
hpotter1 on the CS computers, you'll need to log in as user@host like this:
scp myprog.py firstname.lastname@example.org:.
To copy an entire directory (
myprogs), use the
-r (recursive) flag:
scp -r myprogs email@example.com:.
Finally, to go the other way and copy files from a remote machine back to your current machine, just swap the source and destination:
scp firstname.lastname@example.org:cs21/myprog.py .
The above tries to copy a file called
myprog.py from the
cs21 directory on
oil.cs.swarthmore.edu. Again, note the trailing dot (.) on that command line.
Back to SwatCS Help Docs