Help Desk
Division of Information Technology Home
 

Using Unix FTP

Using FTP Publication Number SFSC6551, A, April 1993

FTP (File Transfer Protocol) is the user interface to the ARPANET and DARPA standard File Transfer Protocol. FTP supports file transfers between machines connected to the Internet. The Internet is a resource-sharing network consisting of governmental, research, and educational organizations. Machines on the Internet have a unique "host name" and "IP (Internet Protocol) number". You need to know the remote-machine's host name or IP number before you can communicate with it. You also need to have an account and password on the remote-machine if you want to exchange (specifically store) information with the remote-machine. The orion, apollo, and libra systems are connected to the Internet and therefore supports file exchange with other Internet machines.

Some machines offer public or anonymous ftp access. Anonymous access means you can access the machine without a valid account and password on the machine. The anonymous ftp sites allow you only to retrieve information (e.g., software programs, documents, or utilities). You enter the name "anonymous" to the user name prompt and your "electronic mail address" (or "guest") to the password prompt.

Invoking FTP

You initiate an FTP session by typing the "ftp" command at the UNIX command prompt. Next, at the ftp> command prompt, you type the command "open remote-machine" to connect to the machine. You may also type "ftp remote-machine" to connect to a remote-machine. The remote machine will prompt you for your user name and password. If you have an account on the machine, enter your account and password. If you want to use the anonymous ftp service, enter "anonymous" at the user name prompt and then type your "electronic mail account" (sometimes "guest" is accepted) at the password prompt.

When you enter incorrect information for the user name or password, you get a login error message. You can either type "quit" to exit the ftp session and start ftp again or type the "user" command to continue your ftp login. For example, the ftp command "open oak.oakland.edu" will make a connection with the ftp server at the site oakland.edu. The oak.oakland.edu system offers anonymous ftp service; if you don't have a valid account, you can type "anonymous" for the user name prompt and then your "electronic mail address" (or "guest") for the password. You can also type "ftp remote-machine" to connect to a remote machine (e.g., ftp wuarchive.wustl.edu).

Accessible Internet Machines

Some of the accessible Internet machines at San Francisco State University are:

Machine Name System
apollo.sfsu.edu Sun SparcServer 20
libra.sfsu.edu Sun SparcServer 20
gibbs.sfsu.edu Chemistry Sun
toaster.sfsu.edu Computer Science NeXT
futon.sfsu.edu Computer Science NeXT
Some of the popular anonymous ftp sites are:
Machine Name Software
sumex-aim.stanford.edu MAC software
wuarchive.wustl.edu MAC/DOS/Unix software
oak.oakland.edu MAC/DOS software

Getting Help

If you need on-line help on ftp commands, type a question mark (?) or the "help" command at the ftp command prompt (ftp>). You can get detailed information about a particular ftp command by appending the name of the ftp command after the "?" or "help" command. For example, "help open" or "? quit" gives information about the open and quit command, respectively.

Basic ftp Commands

The essential ftp commands you use are described below:

Command Description
ls Lists the file information on the remote machine in the short format.
dir Lists the file information on the remote machine in the long format.
get filename Receives a file (called filename) from the remote machine.
open remote-machine Makes a connection with a remote machine.
put filename or send filename Puts a file (called filename) on the remote machine.
close Terminates the ftp connection.
quit or bye Terminates the ftp session and exits ftp.
pwd Shows your current working directory on the remote machine.
cd directory-name Changes the working directory on the remote machine.
ascii Sets the file transfer format to text mode (use for transferring text files).
binary Sets the file transfer format to binary mode (use for transferring binary files).

Important File Types

You will encounter many different file types when you work with ftp to exchange information. You need to set your file transfer mode (with the "ASCII" or "BINARY" ftp command) for the different file types before you perform your file transfer. Below is a list of possible file types.

File Transfer Mode
Text file (e.g., transfer.txt) ASCII
Spreadsheet file (e.g., figures.wk1) Probably BINARY
Database file (e.g., database.db) Probably BINARY
Word processor file (e.g., paper.wp) Probably BINARY
Program source code (e.g., program.c) ASCII
Electronic mail messages (e.g., john.msg) ASCII
UNIX tar file (e.g., programs.tar) BINARY
Compressed file (thisfile.Z, program.Sit, package.ZIP) BINARY
Uuencoded file (e.g., transfer.uu) ASCII
Executable file (e.g., runthis) BINARY
Postscript or GIF (e.g., myfile.ps or graphics.gif) ASCII

 

If you encounter an unfamiliar file format use the ASCII transfer mode first and then use BINARY if the ASCII mode does not work.

Transferring a File From apollo or libra to Another Machine

Once you ftp to a remote machine from your account, traverse (with the cd directory command) to the directory that contains the file you need. Now, type the ftp command "put filename" to transfer a file from your account to the remote machine. You can use the "mput *" command to put multiple files.

Transferring a File From Another Machine to apollo or libra

Once you ftp to a remote machine from your account, traverse (with the cd directory command) to the directory that contains the file you need. Now, type the ftp command "get filename" to retrieve a file from the remote machine to your account. You can use the "mget *" command to get multiple files.

Closing an FTP Connection

When you finish the file transfer, you close the communication session by issuing either the ftp "quit" or "bye" command.

TOP OF PAGE


HOME
Site Home | What We Do | Help Desk | Account Services | Software | Hardware | Network
Telephone Services | Training | Computer Labs | Web Publishing | Policies | Sitemap | Contact Us

San Francisco State University

Last Modified: 4 Feb 2004
doit@sfsu.edu