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:
- ftp.statslab.cam.ac.uk is currently an alias for
spaces.statslab.cam.ac.uk, but if we ever move our ftp server to
another machine, ftp.statslab.cam.ac.uk will be changed into an alias
for that machine, so the instructions will still work.
- Why change directory to /pub/users/username and not
/var/ftp/pub/users/username? /var/ftp on spaces is the top-level
anonymous ftp directory, which means that users who connect via
anonymous ftp can only see files in /var/ftp. So /var/ftp is
effectively the root directory for anonymous ftp users.
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.
- Type ``ftp ftp.xxxxx.ac.uk''.
- Enter ``anonymous'' as your username, and your email address as
your password.
- Type ``cd /pub/a/b''.
- Optionally, type ``ls'' to get a list of files in this directory
on the remote machine, which should include the file you are looking
for.
- Files with names ending in ``tar.gz'' aren't text files, so type
``binary'' to tell the computer that the file you are going to
download is binary data. If the file you wanted was a text file, you
would type ``ascii'' instead. (TeX and LaTeX files count as text
files for this purpose, because you can edit them with a text editor
like emacs or vi.)
- Type ``get data.tar.gz'' to download the file.
- Type ``quit'' to end the FTP session.
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
- To send a message with an attachment, compose the covering message
as normal, and then when it offers you the chance to send it, press
``a'' for attachments and type the name of the file you want to attach
(tab completion will work). You can repeat the
procedure to add more attachments. When you've finished, press ``y''
to send the message.
- If you receive a message with attachments, the simplest thing to
do is to highlight it and press ``v'' for ``view''. This gives you a
list of all the parts of the email. You may need to press Ctrl-L to
be sure that you are seeing the complete list. Highlight the part you're
interested in, and press Return to view it (if mutt can handle it) or
``s'' to save it to a file.
Pine
- To send a message with an attachment, type the name of the file
you wish to attach into the "Attchmnt:" header.
- To read a message with an attachment, press ``v'', highlight the
attachment and press ``s'' to save it in a file. If you are asked
whether to overwrite or append, then the file you chose to save it to
already exists. If you don't mind losing that file, choose Overwrite;
otherwise, choose Cancel (Ctrl-C) and select another filename.
This document was written by the Statistical Laboratory Computer Officer,
Eva Myers
(
eva@statslab.cam.ac.uk). It is available online at
http://www.statslab.cam.ac.uk/~eva/filetransfer.html .
[Back to
my official home page]