# Copying from UNIX-like environment (Linux, Mac OS X, Cygwin/MingW)¶

## Prerequisite¶

To use examples in this section your ssh environment must be configured and an agent must be running.

## Copying files back and forth¶

With your agent running, copying files is easy with, for instance the scp command and the rsync command. The former works exactly like the cp command, except that it works across the network to copy files from one computer to another. A command like

scp -r mydir/ clustername:


will copy the directory mydir on your personal computer to your home directory on the cluster clustername. To retrieve a file in the mydir folder in the cluster home, to a local folder on your computer you must use

scp clustername:mydir/file1 local/folder/


scp -r mydir/ mylogin@clustername:

In the case you are not using an ssh agent and your ~/.ssh/config is not configured, you will need to also add the -i ~/.ssh/id_rsa.ceci option to the command line.
You can also use the rsync command. The latter is more intelligent in the sense that it only copies what is needed to be copied in the case the target directory already exist and contains unchanged files. Click here for some examples.