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/ cecicluster:
will copy the directory mydir on your personal computer to your home directory on the cluster cecicluster. To retrieve a file in the mydir folder in the cluster home, to a local folder on your computer you must use
scp cecicluster:mydir/file1 local/folder/
If your login on the cluster is not the same as the one on your local computer, and you did not specify your login in your ssh config file, make sure to specify your login with something like the following
scp -r mydir/ mylogin@cecicluster:
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.