CSE 303 - Copying files between machines

Suppose you want to move files between two separate machines, for example, a lab PC and attu. You can do that using scp. scp operates a lot like cp, but with the important distinct that the former knows there's more than one machine in the world and the latter does not.

Moving files from your local machine to a remote machine

  • scp myLocalFile j2@attu:
    Connects to attu as user j2, and then copies the file myLocalFile to j2's home directory there.

  • scp myLocalFile attu:
    IF your login name on the local machine is the same as your login name on attu (e.g., j2 in the previous example), copies myLocalFile to your home directory on attu.

  • scp cse303/hw3.tar.gz attu:homework/j-2-hw3.tar.gz
    Copies the local file to attu as the file named j-2-hw3.tar.gz in directory ~/homework.

  • scp -r ~/bin attu:
    Copies the local directory ~/bin and (recursively) all of its contents to your home directory on attu
  • Moving files from a remote machine to your local machine

    Do the same things as above, just reverse the order of the arguments.

    Note

    The explanation above was for using command line scp, e.g., in a cygwin window. You may already have (and certainly can find) programs that put a graphical front-end on scp if you prefer.

    No matter what, though, you won't be able to connect to or transfer files to the department's Linux machines unless the tool you're using employs secure connections: ssh, scp and the like work, telnet, rsh, rcp and their ilk do not.