Assuming youve read the previous section on how to copy
files to the cluster, the reverse, copying files back from the cluster, is easy
considering the information given.
Here is an example copying the file foo from the home directory of
axiom to the home directory on legio.
Example:
[jdpoisso@legio ~]$ scp axiom.ccmb.med.umich.edu:~/foo ~ jdpoisso@axiom.ccmb.med.umich.edu's password: foo 100% 13KB 13.3KB/s 00:00 [jdpoisso@legio ~]$
Notice that this scp command is little more than a reversal of two
arguments. This is because as mentioned before, the last argument to an
scp command is the destination, while the one that precedes that
argument is the source. Since we want our destination to be the home directory
on legio, we simply put
``~'' in as destination.
In Linux/Unix, ``~'' is a
shorthand representation for your home directory, and since the scp
command is being run on legio, without any directives to the
contrary, it will copy the file to the home directory on legio. Also
notice that using scp, files on the cluster may be used as a source.
The command will ask for your password and log into the cluster to find the
file at the location specified and copy it to the destination if found. You may
even still use the ``-r''
argument if the source on the cluster is a directory!
As you should be able to deduce, the scpcommand is
sensitive to location. Meaning the computer you are currently logged into.
command will automatically assume, unless there is instruction otherwise,
that the source and destination is on the computer you are currently logged
into. the preceding examples, we specified a computer other than the one
we are currently logged into by typing its full name followed
(without spaces) by a colon. We then write out the source location as we would
normally. So ``~/foo'' means in
the home directory, the file foo. We could instead write
``/tmp/foo'' to mean in the
tmp directory, the file foo. Using this format you can copy
to and from any location (which you have access to) on the cluster system.