Simple Introduction to FTP

What is FTP?

FTP (file transfer protocol) is a method for transferring files between computers attached to the Internet. Programs supporting FTP allow users to easily move files from one Internet-connected computer to another.

This is done by first establishing an FTP connection between the two computers and then issuing the proper commands to effect the file transfer. In some cases you will need to have a user account on the remote computer to establish the FTP connection. Some sites allow anonymous FTP, which means that no account is needed.

The FTP Process

The basic process for transferring files with FTP is to do the following things:

Anonymous FTP

Sometimes an institution wants to make computer files publicly available to anyone on the Internet -- without requiring them to have a computer account. For this purpose they may set up an account on their computer permitting anonymous FTP access. Many anonymous FTP file/program libraries are available on the Internet.

Establishing an FTP connection to a site supporting anonymous FTP is easy. When you are prompted for a userid, you enter the word anonymous; then for a password, you enter either your local computer electronic mail address or your name. For example, if your userid is ABC101 and you have an account on PSUVM you would enter the following:

        user:  anonymous
        Password:   ABC101@psuvm.psu.edu

If you are working from a client on your microcomputer and you have an Access account userid of XYZ999, you would enter the following:

        user:  anonymous
        Password:   XYZ999@psu.edu

Please note that anonymous FTP sites typically do not permit users to put files on the anonymous FTP server. Contributions to an anonymous FTP server typically must be made by contacting the owner of that server.

FTP Clients

A client is a computer program that acts as a requester to another computer program called a server. The client provides a user interface and user commands to access information or network services from the server. Clients are developed to take best advantage of the capabilities of the local operating environment, such as mouse control, windows, etc.

For simple downloads from anonymous FTP sites, you may elect to use a gopher or WWW client (such as NETSCAPE). However, you will not be able to use these for non-anonymous FTP's or to upload files.

For complete FTP, one will have to use an FTP client developed for their computer and operating environment. For example, a user with an IBM-PS/2 and the Windows environment should acquire an FTP client that works with Windows. A user with a Macintosh should use the Dartmouth FETCH FTP client. By using the proper FTP client the user is taking advantage of the full potential of their computer system.

However, FTP clients are more easily understood if the user has an understanding of generic FTP concepts. The remainder of this document will describe generic FTP. If you are using an FTP client for your operating environment you will want to read the client documentation to learn how to use FTP with that client. FTP clients are provided at the CAC public microcomputer labs (both MS-Windows and Macintosh versions) and for the CACSLIP (DOS), CACTWIN (Windows) and CACMAC (Macintosh) software sets.

Establishing the FTP Connection - Generic FTP

One way to establish an FTP connection with a remote host computer is by issuing the generic FTP command and specifying the Internet name of the desired host computer. This is the way to launch FTP from PSUVM or from a terminal session on the CAC Sun cluster. An example of this is:

     FTP  ftp.cac.psu.edu

You will then be prompted to provide a user name and password. If your intent is for anonymous FTP please refer to the section on anonymous FTP earlier in this document.

Navigating the Directory Structure

Most computers supporting FTP have their file directories arranged in what is called a hierarchical file structure. This means that files are grouped in directories and subdirectories.

Typically, when you first establish an anonymous FTP connection, you will be set to the root directory of the remote host. This is the topmost directory. It may contain files, subdirectories, or both.

Issuing the DIR command at this point will retrieve for you a directory listing of the files and subdirectories on the current (root) directory. To see what is in this directory, type DIR and press the key.

     DIR

You will then be presented with a directory listing that looks something like the following:

   -r--r--r--        5     root     wheel     5123 Aug 10   8:03  README
   drwxr-xr-x     5     root     wheel     1024 May   5 10:58  bin
   drwxr-xr-x     5     root     wheel     1024 May   5 10:58  pub
   drwxr-xr-x     5     root     wheel     1024 May   5 10:58  etc
   drwxr-xr-x     5     root     wheel     1024 May   5 10:58  users
   -r--r--r--        5     root     wheel       512 Sep  21  9:19  .profile

This directory listing gives some important information. For example, the letter d in the first column of the listing indicates that this is a subdirectory under the current directory. So, you can deduce that bin, pub, etc and users are all subdirectories. The remaining listings are for the files README and .profile.

You may change the current directory to one of the subdirectories through use of the CD command. The format of this command is:

     CD 

A few examples based on the above directory listing follow. Please note that upper and lower case are very important distinctions on many host computers. Thus ETC and etc are not the same thing.

CD bin
CD ..
CD pub

This method works when the subdirectory you wish to change to is located under the current directory. You may find that you have to traverse a number of subdirectory levels to find the items you want.

Moving up one level in the directory tree is quite easy. Issue the CD command followed by two periods, as in:

CD   ..

Issuing this command will move you to the directory above the current directory, making that one the new current directory.

A shortcut you may want to use is to CD directly to the root directory. You may do this by means of the following command:

CD /

Please note that the symbol for the root directory, when used with the CD command, is / (forward slash). This is different than the \ (back slash) character used for subdirectories in DOS.

Using the CD command you can now navigate around the directory structure of any host you are connected to with FTP.

Changing the Local Drive or Subdirectory

You may now need to change, on your local computer, the local diskette drive or subdirectory. When FTP is used at the CAC microcomputer labs it is necessary to receive files to a floppy disk.

The command for changing the local drive or subdirectory is DRIVE. For example, to change to the root directory of a floppy disk in drive A: you would use the command:

DRIVE A:

Specifying File Type in Preparation for File Transfer

Before actually transferring files, you will need to inform FTP of the file type. This type may be ASCII, meaning pure text, or BINARY, meaning other than pure text. The distinction is important, because without specifying the file type there is the chance that the file transfer will be done incorrectly and you will end up with a jumbled (and unusable) file.

Once you specify a file type, that type will remain in effect until you either change it or close the FTP connection. The default (initially set) file type is ASCII.

You set the file type by issuing the command ASCII or the command BINARY as in the following examples:

     ASCII

or

     BINARY

Some systems will have additional formats available (e.g. MacBinary) and some FTP clients have the ability to automatically determine the correct transfer format.

Getting a File from a Remote Host

Once you have established the FTP connection with a remote host, changed subdirectory to that which contains the file or files you want, and changed the local drive and subdirectory to the one where you want the files to reside, you are now ready to copy the files from the remote computer.

The command for doing this is GET. The form of the GET command is:

GET  

where:

is the name of the file on the remote host computer

is the name you want the file to have when it is copied to your local computer

Putting Files on a Remote Host

The steps for copying files to a remote Internet host are essentially the same as those for copying files from a remote Internet host. The exception is that you must use the PUT command instead of the GET command.

The syntax of the PUT command is as follows:

PUT   

where:

is the name you want the file to have when it is copied to your local computer

is the name of the file on the remote host computer

Built-in FTP Help

When you are connected to a remote host via FTP there is some online help available. To get this online help you would enter one of the following commands:

help

or

?

You will then be presented with a list of available FTP commands. Please note that different hosts will support different commands, although the commands provided in this document should be available on all hosts.


This page is maintained and made available for educational use by Dr. Gerry Santoro, gms@psu.edu