Microcomputers and Workstations

Ask Dr. Micro: What is FTP and how do I use it?

"Ask Dr. Micro" provides answers to workstation and microcomputer questions of general interest. Answers to common questions are available through the Workstation Support Services World-Wide Web server (http://wss-www.berkeley.edu/). Dr. Micro had help from Seth Novogrodsky in answering this question.

Dear Dr. Micro: I have seen references to "FTP" in this newsletter and elsewhere, but I am not sure what it is or how to use it. Could you explain it to me? --Filologist

Dear Filologist: FTP stands for "file transfer protocol," and it is a method through which computers on the Internet can exchange files. (FTP should not be confused with file transfer protocols designed specifically for transferring files between two computers using a modem and telephone line such as Kermit, XMODEM, and ZMODEM; those protocols are independent of the Internet.)

Like a number of other Internet services, FTP is a based on a "client/server" model; that is, a computer acting as an FTP server will allow a computer running FTP client software to connect to it for the purpose of sending and receiving files. To establish a connection to an FTP server, you generally need to provide a user name and a password in addition to the Internet address of the server (for example, hostname.berkeley.edu); someone would need to set up a user account and assign a password for you before you would be able to access the server.

There are, however, many files available to the Internet community by what is known as "anonymous" FTP. With anonymous FTP, you use the word "anonymous" as the user name and your identity (normally your electronic mail address) as the password. Files available by anonymous FTP include software, documents of all types, and data files. FTP servers that provide anonymous FTP service are sometimes referred to as FTP sites or FTP archives.

Many of the files available via the World-Wide Web are transferred through anonymous FTP. Web browsers generally handle FTP file transfers transparently, so that users are often unaware of the protocol being used to transfer files.

How FTP servers are organized

An FTP server will typically appear to an FTP client program as a group of files and directories (or folders), which in turn contain other files and directories. Most servers on the Internet that offer files by anonymous FTP contain at the top level one or more "read me" files and a directory called "pub" that contains publicly accessible files. The "read me" files often have names that start with "00" (two zeros) such as "00readme.txt" so that these files will appear first in an alphabetical listing. The "read me" files generally describe the purpose of the archive, how it is organized, and the formats of the files stored there. In addition to a general "read me" file, some archives have a file, sometimes called "00index.txt," that provides an index of the archive's contents. It is a good idea to read the "read me" files before retrieving other files from the FTP site.

Files on FTP sites are stored in various file formats, often indicated by a period followed by a suffix appended to the name of the file. For example, files whose names end in the suffixes ".arc," ".cpt," ".gz," ".sit," ".Z," ".zip," and ".zoo" are files that have been compressed using various techniques. (Files on FTP sites are often compressed to reduce the amount of space they occupy and to reduce the amount of time it takes for them to be retrieved.) If you retrieve a file in one of these formats, you will need to run a program on your computer to "uncompress" the file unless the FTP client program you are using performs these conversions automatically. Other file name extensions indicate graphics formats (such as ".gif" and ".jpg"), text representations of binary files (".hqx" and ".uu"), UNIX archive formats (".tar" and ".shar"), etc. Sometimes you may see multiple extensions appended to a single file name, which indicates that more than one format has been applied to the file.

It is important to understand what format the files that you are retrieving are in because certain types of files require that you use a specific FTP file transfer mode; in particular, to transfer text files you normally need to use FTP in "ASCII" mode, and to transfer binary files you normally need to use "binary" mode. For example, compressed files normally need to be transferred using binary mode. (FTP client programs have commands that allow you to specify the file transfer mode.)

FTP commands

When an FTP connection is established between two computers, the computer acting as the client issues specific commands to the computer acting as the server. Many of these commands are similar to basic file manipulation commands used in the UNIX operating system. In some cases, the user will type in commands directly, which the FTP client software will interpret and send to the remote computer. These commands vary somewhat depending on the particular software being used; Table 1 at the end of this article summarizes some of the most commonly used commands. With some FTP client software, users do not need to enter these commands; instead, the client software will send the appropriate commands to the FTP server when the user chooses an item from a menu or clicks on a button, for instance.

FTP client software

FTP client software is available for Macintosh computers, IBM-compatible personal computers, UNIX workstations, and other kinds of computers. To run an FTP client program directly on a microcomputer or workstation, your computer must have a direct connection to the Internet, through direct cabling to the campus network, through the Home IP service offered through the campus high-speed modem lines, or through a private Internet service provider. In addition, many shared computers on campus, including virtually all computers running UNIX, have FTP client software already installed on them.

Web browsers. Web browsers such as Netscape Navigator and Internet Explorer can function as FTP clients. (The "native" protocol for the World-Wide Web is "HTTP" [HyperText Transport Protocol], not FTP.) Web browsers access servers providing anonymous FTP via URLs of the form ftp://hostname/ (to access an entire server) or ftp://hostname/path/filename (to access an individual file). For example, to connect to the top level of the FTP server at ftp.cc.berkeley.edu, the URL that the user would specify for the browser would be ftp://ftp.cc.berkeley.edu/, and to access the file "README" in the "pub" directory of the same server, the URL would be ftp://ftp.cc.berkeley.edu/pub/README. Some browsers allow files to be "uploaded" (i.e., transferred to the FTP server) as well as "downloaded" (i.e., transferred from the FTP server to the user's computer), whereas others permit only downloading.

It is possible to use URLs in many browsers to access nonanonymous FTP resources. These URLs are of the form ftp://username:password@hostname or ftp://username:password@hostname/path/filename. Using URLs that include a user name and password can pose something of a security risk, since the password will be visible to anyone who sees you enter the URL.

Web browsers may not be a ideal tools for accessing FTP servers in some cases. Dedicated FTP clients often have more features and may be easier to use for the purpose of transferring files. For example, dedicated FTP clients often allow more than one file or even entire directories or folders to be transferred with a single command.

Macintosh FTP clients. There are a number of easy-to-use FTP client programs for the Macintosh, including Fetch, which was developed at Dartmouth College and is available free of charge to campus computer users. Fetch allows users to transfer files between a Macintosh and other computers on the Internet without the need to learn FTP commands. Fetch allows you to create "shortcuts" and "bookmarks" for connecting to frequently accessed computers, and you can transfer individual files or groups of files. Fetch can automatically convert files in a number of different formats, including BinHex (".hqx"), AppleSingle, Compact Pro (".cpt"), StuffIt (".sit"), and MacBinary, into forms usable by your Macintosh. (Macintosh files, including applications and documents created by Macintosh applications, are typically stored in these formats on FTP sites.) Fetch is available to campus users from http://cobweb.berkeley.edu/Text/Software/Fetch/Docs/Summary.html, and is also available on the "Supported Software" volume of the campus Cornucopia file server in the "Networking" folder.

PC FTP clients. A number of FTP client programs are available for IBM-compatible personal computers running DOS and Microsoft Windows. Both Windows 95 and Windows NT include a basic FTP utility, called ftp, that has a command-line user interface and operates much like the standard FTP client program used on computers running the UNIX operating system. The DOS FTP client programs also usually use a command-line interface. With these programs, users typically enter commands such as those in Table 1 to transfer files.

FTP clients that use a graphical user interface such as WS_FTP LE and Rapid Filer tend to be much easier to user than the FTP clients with a command-line interface. WS_FTP is available from http://www.ipswitch.com/downloads/ws_ftp_LE.html. Rapid Filer is included with Novell's LAN WorkPlace for DOS, which has been widely used on campus by PCs running Windows for Workgroups 3.11.

FTP client software for UNIX workstations, shared UNIX computers, and other shared computers. Virtually all computers running the UNIX operating system, including UNIX workstations and the shared campus server Socrates, have an FTP command. This command, called simply ftp, allows users to transfer files using commands such as those in Table 1. The campus IBM mainframe computer has a similar FTP command.

For information on using the ftp command on a UNIX computer, type the command man ftp at the UNIX prompt. In addition, some useful information on using FTP is available on the UCLink Gopher server at gopher://uclink.berkeley.edu:1604/11/internet/ftpdir.

Getting started with anonymous FTP and where to look for more information

Because there is an enormous variety of files available through anonymous FTP, it is not a good idea to browse through the archives unless you have some idea of what you are looking for and where you are likely to find it. It is a good idea to obtain the "read me" files and read them before doing much browsing around. In addition, it is best to try to access the more popular Internet archives outside normal working hours both because you are more likely to be able to connect to the site and as a courtesy to other users who may not be able to access the site at other times.

If you would like information about specific FTP sites, an excellent resource is the Monster FTP Sites List (http://hoohoo.ncsa.uiuc.edu/ftp/). This site includes the "Anonymous FTP FAQ [Frequently Asked Question list]" and an extensive, multipart listing of FTP sites.

Table 1: FTP commands

ascii

Set file transfer mode to ASCII. This mode is the default, and it is used for transferring text files.

binary

Set file transfer mode to binary. Binary mode is used for transferring binary files, including executable program files and binary data files.

bye

End an FTP connection and exit FTP client program.

cd

Change to specified directory on remote computer.

close

End an FTP connection.

dir

Display the contents of the current working directory or specified directory on the remote computer.

get

Retrieve the specified file from the remote computer and save it on the local computer.

help

Display a list of valid commands or a description of the specified command.

lcd

Change to the specified directory on the local computer or display the name of the current working directory on the local computer.

ls

Display an abbreviated list of the contents of the current working directory or specified directory on the remote computer.

mget

Get multiple files as specified.

mput

Save copies of multiple files from the local computer onto the remote computer.

open

Establish an FTP connection to specified computer on the Internet.

put

Save a copy of a file from the local computer onto the remote computer.

pwd

Display name of the current working directory of the remote computer.

[ Next Article | Contents | Search BC&C | BC&C Main Menu | IST | UC Berkeley ]

Berkeley Computing & Communications, Volume 8, Number 1 (Winter 1998)
Copyright 1998, The Regents of the University of California