# Transferring files from one Linux computer to another

## Introduction

If you are leaving the CMS, you may wish to transfer some or all of your files to your account at your new job, so that you can still access them after your Maths account has been disabled. If you are a visitor, you may find it useful to generate data on the CMS machines but store it at your home university to avoid exceeding your quota here. The detailed instructions on this page explain how to copy all your Maths files. To copy only a subdirectory, replace all references to /home/CRSid with the full name of the directory you want to copy.

A couple of caveats before you begin:

• Some computer systems have "quotas" or automatically enforced limits on the amount of disk space available to each user. None of the procedures on this page will use any extra space in your Maths home directory, but if you have a quota on your other account, be careful not to exceed it. If using the old "tarball" method of transferring your files rather than the new "rsync" method, be aware that the tarball will not disappear when you extract your files. Therefore you will need to have enough space available for both the tarball and your files - ideally twice the amount you are using in the CMS.
• These instructions assume that your other account is on a Unix system and that you are comfortable with ssh and switching back and forth between sessions on the two machines. They will work for transferring files to a laptop as long as you are sitting at it (normally you cannot ssh into a laptop, only out of it). The flavour of Unix shouldn't matter, but if your other account is on a Windows system, please consult its CO for advice.

Once you have transferred your files, you may want to delete some of them from the Maths system.

I will use some "placeholder" terms which must be replaced by your own info as follows:

CRSid
ssh.maths
Any maths computer to which you have login access - ssh.maths.cam.ac.uk is a good choice as it is always on
An account on a non-CMS Unix system e.g. your home university for visitors, your new job for leavers, or just your laptop.

## The new "rsync" method

The best way to copy a directory from one Unix system to another is to use rsync. Log into your new account and run two commands.

First create a directory for your Maths files (the name doesn't matter).

mkdir my_maths_files


Now copy them over.

rsync -avz CRSid@ssh.maths:/home/CRSid/ my_maths_files


## The old "tarball" method

1. Create a tarball of your files in a temporary directory.

On a Maths machine, create yourself a directory in store space, then create a tarball of your Maths files in that directory. To set up your store space

store-space # List the store spaces you can use
store-space create DAMTP # Or DPMMS or any store space you can access

cd /store/DAMTP/CRSid
tar czvf CRSid.tar.gz /home/CRSid


Note: The above command should list your files as it tars them up. Some people have reported that it failed because /home/CRSid is a link. In that case /home/CRSid should be replaced by your real home directory path.

Note: You can use data space instead of store space, and the procedure will also work with scratch space as long as you use the same Maths machine in this step and the next.

2. Copy the tarball to your other account.

scp CRSid@ssh.maths:/store/DAMTP/CRSid/CRSid.tar.gz ~

3. Untar the tarball in your other account.

Stay in your other account - you now have a file called CRSid.tar.gz in your home directory. To untar it (extract all your files) type

tar xzvf CRSid.tar.gz


On some older versions of Unix, this will not work, and it will be necessary to run the following two commands instead:

gunzip CRSid.tar.gz
tar xvf CRSid.tar

4. Tidy up - delete both copies of the tarball.

The above steps will create a home/CRSid subdirectory in your other account, containing all your Maths files. You can now safely delete both copies of the tarball (the one on your other account and the one in /store/DAMTP/CRSid).