next up previous contents
Next: Copying from the Cluster Up: The Raw Basics Previous: Logging into the Cluster   Contents

Copying files to and from the Cluster


The preferred method of copying files to a cluster is using scp (secure copy). a Linux workstation you may use this command to copy files to and from the cluster system. If using a Windows based system, there are third party utilities, such as WinSCP, that you may use to copy file. The usage of this utility, however, is not covered in this document.



Copying to the cluster -



Here is an example of copying the file foo from workstation legio &rarr#to;the cluster axiom.

Example:

[jdpoisso@legio ~]$ scp foo axiom.ccmb.med.umich.edu:~ 
jdpoisso@axiom.ccmb.med.umich.edu's password: 
foo                                           100%   13KB  13.3KB/s   00:00    
[jdpoisso@legio ~]$



The file foo has just been copied to from workstation legio to the home directory of jdpoisso (represented by the ~) on axiom. Notice as with ssh a password is requested, and then the progress of your file copy is shown on subsequent lines before returning you to your command prompt.


This command however assumes you are copying to your home directory on the axiom cluster, what if you wanted to copy the file somewhere different? Say maybe to /tmp ? In this case you can change the part of the command after the colon as in this example.

Example:

[jdpoisso@legio ~]$ scp foo axiom.ccmb.med.umich.edu:/tmp
jdpoisso@axiom.ccmb.med.umich.edu's password: 
foo                                           100%   13KB  13.3KB/s   00:00    
[jdpoisso@legio ~]$



So far the examples have only demonstrated the copying of a single file. What if, instead of a single file, you want to copy a whole directory or folder? This is accomplished with an argument to the scp command. For basic purposes, an argument may be defined as any additional data appended to a command, where each argument is separated by white space. So the command:


scp foo axiom.ccmb.med.umich.edu:/tmp

Has two arguments to the scp command ``foo'' and ``axiom.ccmb.med.umich.edu:/tmp''. Most commands in Linux/Unix accept arguments, and tend to expect them in a certain order. scp command expects the last argument on the command line to be the destination of the file copy, while the preceding argument is generally considered to be the source file. may also give the scp command an optional argument of the form ``-r'' which if present will copy any and all directories found at the source.

Example:

[jdpoisso@legio ~]$ scp -r data axiom.ccmb.med.umich.edu:~ 
jdpoisso@axiom.ccmb.med.umich.edu's password: 
interface.c                                   100% 2730     2.7KB/s   00:00    
architechture.c                               100% 1214     1.2KB/s   00:00    
DSCF1692-1.jpg                                100%   61KB  61.1KB/s   00:00    
architechture.h                               100% 7895     7.7KB/s   00:00    
main.c                                        100%  420     0.4KB/s   00:00    
alcove.c                                      100%  971     1.0KB/s   00:00    
interface.h                                   100%  182     0.2KB/s   00:00    
alcove.h                                      100% 6781     6.6KB/s   00:00    
[jdpoisso@legio ~]$



Notice now that there are multiple files copied, this is because the source, data , rather than being a single file, was a directory. The -rafter the scp was an argument that directed the scp command to copy from the source, all directories and all contents in those directories, to the destination location.




Subsections
next up previous contents
Next: Copying from the Cluster Up: The Raw Basics Previous: Logging into the Cluster   Contents
2010-08-27