How to use FTP

File Transfer Protocol

FTP is a method of retrieving files from other computers on the Internet. Normally, you need a password and authorised access in order to get hold of a file from elsewhere, but there is a special case of FTP called Anonymous FTP, which allows Internet users access to the many hundreds of thousands, maybe millions, of files which are available in this way.

All you need is the use of a computer which has a direct TCP/IP connection to the Internet and the name (or numeric address) of the site you want to download from (the exact directory name and filename is also useful, but often not essential, as you can browse through what is available).

The names of machines are usually in the format machine.site.network, for example rtfm.mit.edu, but you can also use the numeric (IP) address if you know it (four numbers separated by dots, eg 18.70.0.209). Note that some countries add a fourth, and sometimes even a fifth, element to the name, eg juno.cs.soton.ac.uk.

Using FTP

Graphical systems

If you are using a windowing system like a Mac, PC (Microsoft Windows), or X Windows, you should have a graphical FTP program which lets you type the address and partial file details (and save the setup for future re-use): you then do everything else with the mouse. The setup should allow you to specify anonymous as the UserID, and you should give your email address as the password.

Screenshot of FTP setup Screenshot of FTP folders

Graphical FTP (like the ws_ftp shown) usually displays two panels, one being your local hard disk and the other being the remote filestore. To transfer a file, you just click on it to highlight it, and then click on the Transfer or arrow button pointing in the direction you want the file to go: upload means from your desktop to the remote machine; download means from the remote machine to your desktop.

Commandline systems

If you are using regular commandline UNIX or VMS, where you have to enter commands from the keyboard, type the ftp command followed by the name or number of the site you want to download from, eg:

ftp  ftp.hea.ie

Assuming your network connection is up and running, you will see the reply something like:

Connected to Danann.hea.ie.
220 Danann.hea.ie FTP server (Version wu-2.4(1) Fri Apr 15 13:05:51 BST 1994) ready.

When it asks for your name, type anonymous (if you are on a DEC VAX/VMS system, you have to type login anonymous instead). The remote site will then ask for your password:

Name (ftp.hea.ie:xxxxxx): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password: jilluser@foobar.ucc.ie
230 Guest login ok, access restrictions apply.

Type your eMail address in full in response to this question. Note that it will not display on the screen, for security reasons. You will then be connected and ready to work, and will see the prompt

ftp>

on the screen. Some informational messages may be displayed by the remote system. If you get this far, skip the next section.

Problems connecting

In graphical system, error messages may be displayed in a small window at the bottom or to one side: watch out for them!

Finding your way around (navigating)

Graphical systems let you double-click the folder (directory) names in the normal way. In character-mode systems you can type

dir

to see a list of files and directories. On UNIX hosts, the directory or filename is the last column on the right, for example:

ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 993
drwxr-xr-x   6 root     system       512 Jul 22 1994  .Gopher
-rw-r--r--   1 root     system       577 Aug 15 1994  .GopherMainMenu
drwxr-xr-x   2 root     daemon       512 Nov 23 10:47 .html
dr-xr-xr-x   2 root     system       512 Nov 21 01:07 bin
-rw-r--r--   1 root     ftp       991232 Feb 20 16:19 core
dr-xr-xr-x   3 root     system       512 Dec 02 10:45 etc
-rw-r--r--   1 root     daemon      1915 Feb 27 13:00 index.html
drwxrwsr-x   3 root     200          512 Nov 25 10:14 noc
drwxr-xr-x   3 root     system       512 Nov 17 15:44 part1
drwxr-xr-x   6 root     system       512 Nov 17 15:43 part2
drwxr-xr-x   3 root     system       512 Jan 12 16:03 part3
drwxr-xr-x   6 root     system       512 Oct 21 19:20 part4
drwxr-xr-x   4 root     system       512 Jan 11 12:02 part5
drwxr-xr-x   3 root     system       512 Feb 03 11:45 part6
drwxr-xr-x   3 root     system       512 Feb 03 11:46 part7
drwxr-xr-x   7 root     system       512 Feb 13 09:37 pub
drwxr-xr-x   4 root     system       512 Dec 02 10:45 usr
226 Transfer complete.
1054 bytes received in 0.22 seconds (4.8 Kbytes/s)
ftp>

Subdirectories (folders) are indicated with a letter d in the first character position on the line. Graphical systems usually show folders in a separate window from files.

Retrieval

When you have located the directory and file you want, you can start retrieval. As mentioned before, graphical FTP programs let you do this with a mouseclick, but in both cases you do need to make sure that your program is set correctly:

If the file you want is binary (ie non-text, such as programs, compressed archives, or images), you must first of all set your transfer type to BINARY, or type

binary

otherwise file transfer will not work correctly. Common filetypes for binary files are .zip, .tar.Z, .gz, .gif and .sit: if you are uncertain, you should check with someone who knows. PostScript (.ps or .eps) files and Mac .hqx files are ASCII, not BINARY.

Files will end up in your current directory: if you want them elsewhere, use the lcd command (local change directory) to change to another directory on your own machine.

To retrieve a file, just type get followed by the filename:

ftp> binary
200 Type set to I.
ftp> get mapvu20.zip
200 PORT command successful.
150 Opening BINARY mode data connection for mapvu20.zip (182437 bytes).
226 Transfer complete.
local: mapvu20.zip remote: mapvu20.zip
182437 bytes received in 46 seconds (3.9 Kbytes/s)
ftp>

The filename must be correctly typed, including upper- and lowercase characters (if applicable):

get Edrift-1.0.5.tar.Z

If you want to get a group of files, perhaps a whole directory, you can use mget (multiple get) instead, but you may want to type the command prompt first (on its own), to stop the system asking you yes or no for each file in turn. You can then type mget * and have it download all the files at once. Graphical FTP usually lets you mark a group of files with the mouse, and retrieve them as a group.

Sending files

If you have access to a machine where you have authority to log in with a real username and password, not `anonymous', you can also send files as well as retrieve them. The same caution as above about binary files holds true, but you then type send or put instead of get. There is an mput command for sending multiple files, analogous with the mget command above.

Some sites running anonymous FTP servers do have an uploads directory for this, but it is normally regarded as a security breach.

Finishing up

You have to wait while the file you have requested is transferred. When it is finished, you will see the ftp>: prompt again, and you can send or retrieve another file, change directory again, or log off. To log off, just type quit