How To Share Files

Many people have asked how to send files to colleagues in other universities, or how to read the files which their colleagues have sent them. This document aims to explain how you can share files with colleagues elsewhere.

Make sure that the recipient will be able to read the files when they receive them. Files in a human-readable format such as plain text, TeX or LaTeX are best, if you can manage it. DVI and Postscript files are also good. Proprietary formats such as PDF or Microsoft Word are not so good, because, for example, documents written with the latest version of Word may not be readable by someone who only has an older version.

If you have lots of files to share, it may be useful to put them all together in one big file. This process is known as ``tarring them up'' and is done with the Linux ``tar'' command. (Warning: Windows users may not be able to deal with tar files.) The easiest way to do it is to put all the files you want to share in a directory called (say) shared_files, and then type the following command:
tar czvf shared_files.tar.gz shared_files

The file shared_files.tar.gz now contains all the files in the shared_files directory in a compressed format. To list the files which have been merged into shared_files.tar.gz, the command is:
tar tzvf shared_files.tar.gz | more
and to extract the original files, it is
tar xzvf shared_files.tar.gz

There are three methods for sharing files: WWW, FTP and email. WWW and FTP make the files available to the whole world, unlike email which only sends them to the recipient of the email. I recommend that you use WWW or FTP rather than email for large files or lots of files, as large emails can clog up the network.

WWW

To distribute a file over the WWW, copy it to somewhere in your public_html directory, and then simply include a link to it in your home page. (If you need help with creating a home page, I have written a brief guide to writing your own web pages.) To download a file off the WWW, try clicking on its link. If this doesn't do what you want, you can right-click on its link and select ``Save Link As...'' or ``Save Target As...''.

FTP

If you want to make a file available by FTP, you will need to ask me to create an anonymous FTP directory for you if you don't already have one. This directory will be /var/ftp/pub/users/username (replacing ``username'' with your username) on spaces only. Locate the files you want to make available by ftp and copy them to this directory.

Tell your colleagues to ftp to ftp.statslab.cam.ac.uk, change directory to /pub/users/username and download your files. The observant among you may be curious about a couple of points in these instructions:

If you want to retrieve a file by FTP, you'll need to know the name of the machine to ftp to and the full pathname of the file you want. In this example I'll call the machine ftp.xxxxx.ac.uk and the file /pub/a/b/data.tar.gz . Here are the instructions for downloading a file by ftp on a Unix system. The procedure for Windows is identical except that you need to choose ``Run...'' from the Start menu before typing the ``ftp ftp.xxxxx.ac.uk'' command.

Email

Email is the trickiest method of sharing files, and as I mentioned earlier, emailing large files can clog up the network. I recommend that you use WWW or FTP instead, but if you must use email, here is some advice.

It is easiest to email text files by including them as part of the message - just use the appropriate command in your editor. (Ctrl-x i in emacs, or Ctrl-r in pico, which is the editor used by pine.) If you receive a message with a text file included in this way, copy or export it to a file, and edit the file with your favourite editor to remove the mail headers.

Binary files (files which aren't text files and can't be edited using a text editor) have to be encoded into a text format before they can be sent through email. Your mail program will do this automatically for you if you send the file as an ``attachment'', and will also decode attachments which other people send to you. Here's how to handle attachments with the two most popular Unix email programs, mutt and pine.

Mutt

Pine