Useful Stuff
Copying data to and from Comanche using ''rsync''
You will often want to copy data to and from comanche:
- It may be easier to create directories and files on your laptop,
- plots cannot be easily made on Comanche as it lacks any graphics libraries,
- or, you just want to keep data for your own record.
The best command to move data securely from a Linux machine is rsync. To see how to use it, use
$ man rsync or $ info rsync
This will work for those of you using Linux/Unix/OSX and probably also for those of you using mobaxterm.
Use rsync as follows
$ ls prac1 prac2 prac3
This means I have these three directories. Say I want to copy the data from prac2 to my own laptop. To do this I use:
$ rsync -avz prac2 alston@mylaptop.qmul.ac.uk:~/ESM/lab/
Let's look at this in detail:
The options -avz are quite useful. I use them all the time. See man rsync for details.
prac2 is the name of the directory I wish to copy.
alston@mylaptop.qmul.ac.uk is the full address of my laptop and must include my username.
Specify the directory in which prac2 is to be put using :~/ESM/lab/ (the colon is essential!) What this means is that prac2 should be placed in /home/alston/ESM/lab/. I used ~ as a shortcut for /home/alston/
You will be prompted for your password before the copy progresses.
Note
When copying files, keep in mind that poset has the same home file system as comanche so you can just as well copy files to and from poset.
Important What if you want to copy the contents of a directory and all sub-directories?
Then use:
- $ rsync -r -avz prac2 alston@mylaptop....
The only addition is the -r which forces rsync to act recursively on prac2 and it then copies all the contents of prac2, including files and sub-directories.
Important To force rsync to skip files you do not want use
- $ rsync -r -avz --exclude '*.b' prac2 alston@mylaptop....
This will exclude all files that end in .b.
If you have a long list of files you'd like to exclude then create a file called .rsyncx in your home directory and put the list of patterns in it like so:
- $ cd $ more .rsyncx
- .b
- .c
- .db
Here, files ending in .b, .c and .db will be skipped.