I. What is FTP?
FTP, or File Transfer Protocol, is the name of the application and the protocol used for moving files between two hosts on a TCP/IP network.
Client and Server There are two machines involved in an ftp transaction, a client machine, which is sometimes called the local host, and a server machine, which is sometimes called the remote host. The client is always the machine that initiates the transfer. During an ftp session, it is extremely important to keep track of which machine is the client and which is the server, because this will determine whether you use a get command or a put command to move files. The get command is always used to copy files from the server to the client, and the put command is used to copy files from the client to the server.
As a simple example, consider the case where your desktop computer (e.g., a Macintosh or a DOS PC) runs an ftp client in order to connect to the ftp server on the machine ux1.cso.uiuc.edu. To initiate the process on, say, a DOS machine, you might type the following command, using the Clarkson or PC/TCP ftp program:
C:\PCTCP>ftp ux1.cso.uiuc.edu
After some negotiation with ux1, your ftp client and the ux1 ftp server would be talking to each other, and you would type commands for putting and getting files. Since your PC was used to initiate the ftp connection, it is the client and ux1 is the server. In this case, "putting" means uploading files from your PC to the ux1, and "getting" means downloading files from the to your PC as shown in the diagram below:

The situation can be more complicated, and sometimes it's difficult to decide whether to put or to get. A common example of this is when you are running telnet on a PC to log in to your UNIX account. You log in to your account on ux1 and read your e-mail using Pine. Someone has sent you an attachment that is a DOS executable, typically a self-extracting ZIP file, and you want to download it to your PC. Many telnet applications have a built-in ftp server, allowing you, during a telnet session with a remote UNIX system, to initiate an ftp session from the UNIX system back to your PC. In fact, some telnet applications (e.g., NCSA telnet, PC/TCP, CUTCP), automatically generate the UNIX ftp command for you with the IP address filled in, as if you had typed the UNIX command:
ux1> ftp 128.174.xxx.yyy
where xxx and yyy have been replaced with the appropriate numbers from your machine's IP address. This is exactly equivalent to starting up the UNIX ftp client to establish an ftp connection with your PC. In this case, ux1 is the client machine (or local host), and your PC is the server machine (or remote host) as illustrated in the next diagram. (Needless to say, in this instance, the terms "local" and "remote" are counter-intuitive, since your PC is geographically "closer" to you than ux1.) In order to download your file to your PC, you must use the put command, since you are using the UNIX ftp client to copy the file to your PC, which is acting as the server machine. To upload files to your UNIX account, you would use the get command, for the same reason.

There is a third situation in which your PC, acting as a telnet client only, is used to initiate an ftp session between two remote computers, and therefore is not directly involved in the ftp transaction. In such instances, your PC is neither the ftp client nor the ftp server. For example, if you log in to ux1 and then use the ftp client on ux1 to start an ftp session between ux1 and uiarchive, ux1 is ftp client and uiarchive is the ftp server:
ux1> ftp uiarchive.cso.uiuc.edu
In this case, you get files from uiarchive to ux1, and, if you have special privileges, you can copy files to uiarchive using the put command. This situation is illustrated in the following diagram:

The proper use of several other ftp commands, in addition to put and get, also hinges on an understanding of client and server. For example, the the cd (change directory) command is used to move from one directory to another on the server. If you want to change directories on the client machine, you must instead use the lcd command, which stands for local change directory. As long as you keep in mind the examples and principles outlined above, however, you should have no trouble deciding when to put or get, whether to lcd or cd, etc.
II. FTP Commands
General Information about FTP Commands Most ftp clients are command-oriented and many of the common commands are the same regardless of the platform or operating system. Some commands are executed without any arguments or parameters and some have optional or required arguments.
Abbreviations. The abbreviations listed below are used throughout this guide as variables to refer to local and remote directory and file names.
| Variable Name | Meaning |
|---|---|
| ldirname | local directory name |
| rdirname | remote directory name |
| lfilename | local filename |
| rfilename | remote filename |
Upper versus Lower Case. Remember that UNIX file and directory names are case-sensitive. When referring to a file or directory on a UNIX system within an ftp command, type the name EXACTLY as it is displayed with a dir or ls command.
Wild cards. When writing out filenames, wild cards can be used to display or transfer multiple files. A wild card is a special character (or group of characters) that substitutes for one or more characters in a file or directory name. The most common wil card is the asterisk (*). The * represents any series of adjacent characters in a filename. The * is helpul when you want to list all of the files that start or end with the same few letters. Here are some examples of how the * can be used:
| Example | Explanation |
|---|---|
| read* | Represents all filenames that begin with the string "read", including names like readme.doc, readmeandweep, and read. |
| *html* | Represents all filenames containing the string "html" anywhere in the filename, including names like html-viewer-111.hqx, index.html, and text-to-html-131.hqx. |
| *txt | Represents all filenames that end with the string "txt", including names like abstract.txt and readme.txt. |
| Command Syntax | Command Description |
|---|---|
| Open an ftp session with the specified host. You will be prompted to enter a userid (login name) and password. Examples:
ftp ftp.cso.uiuc.edu |
ftp | Start the ftp client without opening a session with a remote host. Normally, this command will get you to an ftp> prompt. |
open fully.qualified.domain.name | Open an ftp session with the specified host from the ftp> prompt. |
user your_loginname | Tell the remote host the login name of the account you
will be using. Normally you will be prompted for this information when you
connect to the remote host. If you enter your login name incorrectly, you can
use this command to enter the correct information.
Examples: |
| Command Syntax | Command Description |
|---|---|
quit | Close the current session and quit ftp client. You will be returned to the operating system prompt. |
close | Close the current session without quitting the ftp client. You will be returned to the ftp> prompt and can use the open command to open a new session. |
| Command Syntax | Command Description |
|---|---|
ls | Display (list) the contents of the current directory on the remote host. |
ls rdirname | Display the contents of the specified directory on the remote host
Example: |
ls rfilenames | Display the specified files/directories on the remote host.
Examples: |
dir | Display (list) the contents of the current directory on the remote host in long (verbose) format. This command shows the permissions, size, date, owner and group names, etc. for each file in the list. |
dir rdirname | Display the contents of the specified directory on the remote
host in long format.
Example: |
dir rfilenames | Display the specified files on the remote host in long format.
Examples:
|
| Command Syntax | Command Description |
|---|---|
cd rdirname | Change to the specified directory on the remote host. When
changing directories on a Macintosh, surround the directory name with quotation
marks.
Examples:
|
lcd ldirname | Change to the specified directory on the local host. When
changing directories on a Macintosh, surround the directory name with quotation
marks.
Examples:
|
pwd | Display the name of the current directory on the remote host. |
| Command Syntax | Command Description |
|---|---|
ascii | Set the file transfer mode to ASCII. Use ASCII mode for text files (.txt, .doc, .asc. etc.) postscript files (.ps), BinHexed files (.hqx), and uuencoded files (.uue). |
binary | Set the file transfer mode to binary. Use binary mode for most executable files (except shell scripts and batch files), formatted data files, and compressed files. Use MacBinary mode when moving Macintosh binary files to or from a non-Macintosh system. |
The put and get commands take two arguments, a source filename and a destination or target filename. The source filename must always be provided. If a target filename is not provided, the client will attempt to write the file to the target using the source filename. If target file system does not support all of the characters in the source filename, the name will automatically be modified to accommodate the target file system. For example, when moving files from a UNIX system to a PC running DOS, files with names longer than the the 8x3 DOS standard are truncated.
| Command Syntax | Command Description |
|---|---|
get rfilename [lfilename] | Move the specified file from the remote host to the
local host.
Examples: |
mget rfilename(s) | Move the specified files from the remote host to the local
host. You will be asked to confirm the transfer for each file. To turn this
interactive prompting off, enter the prompt command before executing the mget
command.
Examples: |
put lfilename [rfilename] | Move the specified file from the local host to the
remote host.
Examples:
|
mput lfilename(s) | Move the specified files from the local host to the remote
host. You will be asked to confirm the transfer for each file. To turn this
interactive prompting off, enter the prompt command before executing the mput
command.
Examples: |
| Command Syntax | Command Description |
|---|---|
! [command] | Execute an operating system command on the local host. Entered by
itself, ! will shell out to the operating system.
Examples: |
help | Display a list of ftp commands. |
| help command | Display help for the specified command.
Examples: |
prompt | Toggle interactive mode on/off. |
ux1 4> ftp ftp.cso.uiuc.edu (open session with ftp.cso.uiuc.edu) Connected to ux3.cso.uiuc.edu. 220 ux3.cso.uiuc.edu FTP server (Version 2.0WU(11) Tue Apr 13 13:24:04 CDT 1993) ready. Name (ftp.cso.uiuc.edu:ward): anonymous (log in as anonymous) 331 Guest login ok, send your complete e-mail address as password. Password: lynnward@uiuc.edu (enter e-mail address as password; it will not echo to screen) 230-Please read the file README 230- it was last modified on Mon Mar 15 11:54:07 1993 - 238 days ago 230 Guest login ok, access restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. ftp> dir (display the current directory) 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 1598 drwxr-xr-x 22 root wheel 1024 Oct 7 10:40 . drwxr-xr-x 22 root wheel 1024 Oct 7 10:40 .. drwxrwxr-x 2 zinzow pc 512 Mar 2 1991 .bin -rwxr-xr-x 1 root wheel 1000 Apr 14 1993 .cache -rw-rw-r-- 1 root amiga 2073 Feb 24 1989 .microupdate -rw-rw-r-- 1 root amiga 2050 Feb 24 1989 .microupdate~ drwxr-xr-x 3 383 ftp 1024 Nov 4 12:00 ACM -rw-r--r-- 1 zinzow ftp 4427 Mar 15 1993 README drwxrwxr-x 11 wahlmann amiga 512 Aug 22 00:47 amiga drwxrwxr-x 2 zinzow ftp 1024 Jan 20 1993 bbs drwxr-xr-x 2 root wheel 512 Apr 13 1993 bin d--x--x--x 2 root wheel 512 Apr 13 1993 dev drwxrwxr-x 15 138 wheel 512 Apr 15 1993 doc d--x--x--x 3 root wheel 512 Apr 13 1993 etc -rw-r--r-- 1 zinzow ftp 145528 Jan 2 1992 ftp.list -rw-rw-r-- 1 zinzow ftp 21470 Mar 25 1990 ftp.oldlist.Z drwxr-s--- 4 root uiftp 512 Apr 22 1993 licensed drwxr-xr-x 2 root wheel 8192 Sep 11 1992 lost+found -rw-r--r-- 1 root wheel 582439 Nov 6 00:20 ls-lR.Z drwxrwxr-x 9 dlong wheel 512 Oct 7 12:24 mac drwxr-xr-x 2 paul wheel 512 Jan 20 1993 mail drwxrwxr-x 30 kerr wheel 1024 Apr 16 1993 math drwxrwxr-x 3 254 wheel 512 Oct 13 19:57 mrc drwxr-xr-x 14 root wheel 512 May 25 10:56 net-nav drwxr-xr-x 20 zinzow wheel 512 Apr 26 1993 pc drwxr-xr-x 2 root wheel 512 Jan 20 1993 tandy drwxr--r-- 2 zinzow wheel 1536 Oct 12 12:39 tmp drwxr-xr-x 11 roma source 512 May 18 00:29 uiuc drwxrwxr-x 6 zinzow wheel 512 Apr 15 1993 unix-pc-tools 226 Transfer complete. ftp> ascii (set trasnfer type to ASCII) 200 Type set to A. ftp> get README (transfer the file named README to the local host) 200 PORT command successful. 150 Opening ASCII mode data connection for README (4427 bytes). 226 Transfer complete. 4523 bytes received in 0.04 seconds (1.1e+02 Kbytes/s) ftp> ! more README (shell out to the operating system and use a pager to read the file named README on the local host) 10/28/91 I get frequent complaints about files with errors. 99% of the time it turns out the complainer forgot to transfer them in binary mode somewhere along the line. Please check this before writing us. Thanks! M.S.Z.Brief overview of UIUC's anonymous ftp collections for Personal Computers:
Host: ftp.cso.uiuc.edu
These are the main directories, who maintains them, and briefly what they contain. My policy is that all *major* directories contain a README file stating at least the names of index files to the collection there, and who maintains that area. Directories marked with an asterix '*' contain administrative files as opposed to user downloadable files. These are maintained by Bob who has root authority on ux1.
/ Mark Zinzow and Bob Foertsch bob@uxa.cso.uiuc.edu * This is /pub for local users and contains all the directories listed below as well as a copy of Jon Granrose's ftp.list of ftp sites.
/ACM acmftp@ux1.cso.uiuc.edu ???? (To be added soon after 3/15/93) Contains information related to UIUC's student Association for Computing Machinery chapter. ftp> cd /pc/nupop (change to the /pc/nupop directory on the remote host) 250-Please read the file README 250- it was last modified on Mon Oct 18 12:55:28 1993 - 21 days ago 250 CWD command successful. ftp> dir (display the file contents of the directory named /pc/nupop) 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 1542 drwxrwxr-x 2 374 wheel 512 Oct 18 12:56 . drwxr-xr-x 20 zinzow wheel 512 Apr 26 1993 .. -rwxr-xr-x 1 374 wheel 313 Aug 10 11:47 .cache -rw-r--r-- 1 374 wheel 1183 Oct 18 12:55 README -rw-r--r-- 1 374 wheel 688 Aug 16 13:41 dial.scr -rw-r--r-- 1 374 wheel 190680 Oct 13 16:56 nupop.doc -rw-r--r-- 1 374 wheel 351931 Apr 8 1993 nupop103.zip -rw-r--r-- 1 374 wheel 164803 May 12 1993 nupopps.zip -rw-r--r-- 1 374 wheel 35957 Oct 18 12:54 nupopusr.doc -rw-r--r-- 1 374 wheel 679 Apr 8 1993 slipdial.scr 226 Transfer complete. ftp> get README nupop.txt (get the file named README and give it the name nupop.txt on the local host) 200 PORT command successful. 150 Opening ASCII mode data connection for README (1183 bytes). 226 Transfer complete. 1211 bytes received in 4.9 seconds (0.24 Kbytes/s) ftp> binary (set the transfer type to binary) 200 Type set to I. ftp> prompt (toggle interactive prompting off) Interactive mode off. ftp> lcd nupop (change to the \NUPOP directory on the local host) Local directory now C:\NUPOP ftp> mget nupop* (transfer all files with names beginning with nupop to the local host) local: nupop.doc remote: nupop.doc 200 PORT command successful. 150 Opening BINARY mode data connection for nupop.doc (190680 bytes). 226 Transfer complete. 190680 bytes received in 7 seconds (27 Kbytes/s) local: nupop103.zip remote: nupop103.zip 200 PORT command successful. 150 Opening BINARY mode data connection for nupop103.zip (351931 bytes). 226 Transfer complete. 351931 bytes received in 3.8 seconds (90 Kbytes/s) local: nupopps.zip remote: nupopps.zip 200 PORT command successful. 150 Opening BINARY mode data connection for nupopps.zip (164803 bytes). 226 Transfer complete. 164803 bytes received in 6.2 seconds (26 Kbytes/s) local: nupopusr.doc remote: nupopusr.doc 200 PORT command successful. 150 Opening BINARY mode data connection for nupopusr.doc (35957 bytes). 226 Transfer complete. 35957 bytes received in 4.8 seconds (7.3 Kbytes/s) ftp> quit (close the current session and exit ftp)