Starting to use FTP (File Transfer Protocol)
Available Software
- ftp (UNIX): Text-based file transfer client.
- Fetch (Macintosh): User-friendly file transfer client,
recommended for its simplicity and functionality.
- NCSA Telnet (Macintosh): A popular telnet client with
FTP client and server support. Provides a simple way provide
anonymous access to your computer.
- FTPd (Macintosh): Powerful file transfer server that runs
in the background on your computer. Requires some configuration.
- Anarchie (Macintosh): Archie client for searching popular
archive sites. It is also a scriptable FTP client for retrieving lists
of files.
Connecting
To establish an FTP connection with a remote host from a UNIX host,
simply type ftp <host-name>. To do so from a Mac, use the
Fetch program and select Open Connection and enter the remote
host name. In either case, you will need to enter a valid user name and
password, or to establish an anonymous FTP session (username is
anonymous, password is your full E-mail address).
Once you are connected, you can navigate the directory structure of the
remote host to look for desired files or folders. If you are using a Mac
program like Fetch, navigating and retreiving files should be
straightforward. However, if you are using a command line to FTP files,
you should look at the Basic Commands section below.
Basic Concepts
- FTP Client: The program which initiates an FTP session is
the client. It is responsible for sending the commands that send
and receive files. Programs like UNIX ftp and Fetch are FTP clients.
- FTP Server: An Internet host which allows clients to
connect, then request or offer files to be transferred. Most UNIX
hosts offer FTP service to valid users, and NCSA Telnet and FTPd
let your Mac become an FTP file server.
- FTP Archive: An FTP server offering a collection of related
files, generally for public access with anonymous FTP.
- Anonymous FTP: Using FTP to transfer files from a server that
allows anyone to connect. "Anonymous" is a misnomer however, because
most sites request your E-mail address -- it merely implies that
you don't need an established account on that machine. To connect
to an FTP server anonymously, enter anonymous for user and
your E-mail address for the password. Also, most servers display
help messages by default; by prefixing a hyphen to the password
(your E-mail address), you will not receive such messages.
- ASCII File: A simple text file, or a file that has been
converted into ASCII with a program like uuencode or BinHex. Most
files available for FTP are ASCII files.
- Binary File: If a file is raw data and not converted into
an ASCII file, then it is considered binary (not to be confused with
MacBinary below). Graphic images are often treated as binary files,
so such files are also called "Image Files."
- Download: A client sending the get command asks the
FTP server to send the indicated file.
- Upload: A client giving the put command tells
the FTP server that it is sending a file to be stored with the
indicated name.
Basic Commands
- cd [<directory>]: Change current directory to the
indicated directory, or without parameters to the default directory.
- ls [<directory>]: List the contents of the
indicated directory, or without parameters of the current directory.
- dir [<directory>]: List extended information for
the contents of the indicated directory, or without parameters of the
current directory.
- type <transfer-type>: Set the file transfer type
to the indicated type; files must be transferred according to the type
of data or they may be corrupted. Transfer type should be one of the
following: ascii, binary, or macbinary. The default of most FTP servers
is ASCII. MacBinary is only an option for some Mac clients.
- get <remote-file> [<local-file>]: Request
that the FTP server send the file with the indicated name, and save it
with the same or the second file name.
- put <local-file> [<remote-file>]: Send the
indicated file to the FTP server, and save it with the same or
the second file name.
- mget <file-pattern>: Related to the get
command this retrieves multiple files matching the indicated pattern
(using '*' as a wildcard character, so that "*.html" represents
all HTML files in the given directory).
- mput <file-pattern>: Related to the put
command this sends multiple files matching the indicated pattern.
- delete <remote-file>: Delete the indicated file
from the FTP server.
- bye: Close this FTP session.
Using FTP: A Sample Session
The following is a demonstration of a text-based FTP session. We know
the file we seek, the complete text of Treasure Island, resides
on the UIUC server for Project Gutenberg, an anonymous FTP server for
a large collection of public domain literary.
> ftp mrcnext.cso.uiuc.edu
Connected to mrcnext.cso.uiuc.edu.
220 mrcnext.cso.uiuc.edu FTP server (Version wu-2.4(1) Tue Apr 19 13:09:35 CDT 1994) ready.
Name (mrcnext.cso.uiuc.edu:fprefect): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password: -username@umich.edu (The password is not displayed as you type)
230 Guest login ok, access restrictions apply.
ftp> cd pub/etext
250 CWD command successful.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
lost+found
0INDEX.GUT
INDEX100.GUT
INDEX200.GUT
LIST.COM
NEWUSER.GUT
articles
etext90
etext91
etext92
etext93
etext94
freenet
gutmar3.3
hart
interpedia
ippe
note.old
usonly
226 Transfer complete.
214 bytes received in 0.028 seconds (7.5 Kbytes/s)
ftp> cd etext94
250 CWD command successful.
ftp> ls treas*
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
treas10.txt
treas10.zip
226 Transfer complete.
remote: treas*
26 bytes received in 0.0032 seconds (7.8 Kbytes/s)
ftp> get treas10.txt treasure.isle.txt
200 PORT command successful.
150 Opening ASCII mode data connection for treas10.txt (388518 bytes).
226 Transfer complete.
local: treasure.isle.txt remote: treas10.txt
397632 bytes received in 7.5 seconds (52 Kbytes/s)
ftp> bye
221 Goodbye.
Customizing
Both archie, for UNIX, and Anarchie, for the Mac, give you the power
to search numerous FTP archives for a desired file by name comparison.
Once you have found the file or files you seek, you can then use FTP
to download them.
Not only can you use FTP to download files from an FTP archive, but you
can also let your computer act as an FTP server for others to connect
to. Most UNIX systems are already FTP servers, but require a valid
username and password to connect, which is undesirable for general use.
Mac programs such as FTPd and NCSA Telnet also act as FTP servers, and
give the user fine control over access and anonymous transfers.
FTPd is a general tool for that makes your personal computer into an FTP
server for an extended period of time. NCSA Telnet, however, is most
useful for temporarily setting up an FTP server to exchange files
between your computer and a host you are currently telnetting to. With
anonymous FTP enabled, you can select Send FTP Command to
instruct a remote host to connect to your Mac as an FTP client to
server. Then, by sending FTP commands from that remote host, you can
(rather counter-intuitively) "get" files from your Mac to the FTP client
and "put" files from the remote file system to your local computer's
hard disk.
There are numerous programs that collect or encode files for FTP
distibution, and these vary by platform and nature of the data. By
sending compressed data, file transfers use less Internet bandwidth
at the cost of additional user work for both uploading and downloading
files. Here is a summary of different software and file extensions you
may encounter:
Unix Formats
- Shell Archive, shar (.shar): Used to group a collection of
files into one larger file. Output: Uncompressed ASCII;
Software: shar and unshar.
- Tape Archive, tar (.tar): Used to group a collection of files
into one larger file, originally for saving onto backup tape. Type
tar -cvf <directory> to create a tar file of the contents
of the indicated directory, or use tar -xvf <tar-file>
to extract the contents of such an archive. Output:
Uncompressed Binary; Software: tar (see above).
- compress (.Z): Widely available file compression software.
Output: Compressed Binary; Software: compress
and uncompress.
- GNU compress, gzip (.gz): Public domain and popular file
compression software. Output: Compressed Binary;
Software: gzip and gunzip.
- uuencode (.uu): UNIX-to-UNIX encoding, suitable for converting
binary files to ASCII for FTP transfer. Output: Uncompressed
ASCII. Software: uuencode and uudecode.
Macintosh Formats
Quick note: Macintosh files, unlike other computer systems, are
comprised of 2 parts, or forks, that need to be integrated for
transfer. Both BinHex and MacBinary will make suitable files for FTP;
other compression methods are not designed for immediate FTP.
- BinHex (.hqx): Version 4.0 is the de facto standard for ASCII
encoding of Macintosh binary files. Output: Uncompressed ASCII;
Software: BinHex 4.0, Stuffit Deluxe, Compact Pro, and Stuffit
Expander (Decomp. only).
- MacBinary (.bin): An alternative to BinHex, this software
combines both forks into one single binary file for transfer.
Output: Uncompressed Binary; Software: MacBinary.
- Stuffit (.sit): Popular compression format for FTP software
distribution. Output: Compressed 2-Fork Binary; Software:
Stuffit, Stuffit Deluxe, and Stuffit Expander (Decomp. only).
- Compact Pro (.cpt): Powerful compression format for FTP
software distribution. Output: Compressed 2-Fork Binary;
Software: Compact Pro and Stuffit Expander (Decomp. only).
- Self-Extracting Archive (.sea): A double-clickable program
which contains compressed data, such that you don't need additional
software to extract the data. Output: Compressed 2-Fork Binary.
- DiskCopy Image (.image): A format for encoding the contents
of an entire floppy disk, primarily used for system software
distribution. Output: Uncompressed 2-Fork Binary; Software:
DiskCopy, MountImage, or ShrinkWrap.
Email as an alternative to FTP
Because FTP requires an active server to connect to, and most users
do not have an anonymous FTP server available for to post software
for quick distribution, many people often use Electronic Mail to
send files directly to the desired recipients. This eliminates the
need to create an FTP server or to pass out your account password
for others to connect.
All popular mail software has the ability to append a data file
to the end of a message for software distribution. Likewise, each
mail client can also save such a file to disk for later decoding
and use. For most user to user file transfers, it is often preferable
to send it directly by mail than to set up or post it to an FTP archive.
This document was created at the University of Michigan
School of Information and Library
Studies (SILS), but it has been designed for public use. Permission is
hereby granted for unlimited print and electronic redistribution. Your
feedback is encouraged.
fprefect@umich.edu - 1/16/95