FTP GUIDE #1


Source#1

 

Article about FTP


Source #2:

http://www.rohan.sdsu.edu/0301.html

FTP Guide #2


Contents

1.0 What is FTP?
2.0 What is FTP used for?
3.0 What is a file archive?
4.0 How does FTP connect to an Anonymous FTP site?

4.1 Finding a Domain Name or IP Address

5.0 Where are Anonymous FTP sites located?
6.0 How do I invoke FTP on ROHAN?
7.0 How do I open a new FTP session?
8.0 What is Binary vs. ASCII?
9.0 What are compressed files?
10.0 What are tar files?
11.0 What microcomputer software offers FTP?
12.0 What FTP commands are available?


1.0 What is FTP?

FTP is an acronym for File Transfer Protocol and one of the programs using the TCP/IP (Transmission Control Protocol/Internet Protocol) suite. So, what is a protocol? A protocol is a set of rules that govern data interaction on a network. FTP is the rule set that allows files to be transferred between different kinds of computers, without concern for their operating system or how they are connected. But, the local and remote computers must either be able to establish a physical connection, or both must run the TCP/IP protocol and be connected on the Internet.

Return to Contents


2.0 What is FTP used for?

FTP can be used to download public domain software, source code, data files, research tools, utilities and documents for a variety of platforms from publicly accessible file archives. The /pub directory is a standard of file archives and is generally the directory in which to look for transferable files.

FTP can also be used to upload and download files between your microcomputer and your accounts on ROHAN, if your communications software offers the FTP command. See section 11.0 What microcomputer software offers FTP? for more information.

Return to Contents


3.0 What is a file archive?

Basically, a file archive is a storehouse of information. There are many file archives on the Internet. WUARCHIVE at Washington University, Missouri is a computer with a large program and file archive. It includes mirrors of many other programming archives, with megabytes of stuff for DOS, Windows, Macintosh, and other popular computer systems. It also contains the largest collection of GIF and JPEG pictures on the Internet.

Because file archives provide the username anonymous for FTP retrieval of files from their system, they are referred to as Anonymous FTP sites. Their login is called Anonymous FTP login. Your Email address is the accepted password convention for this type of login. Anonymous FTP login works only for file transfers from a remote computer to your local computer. It is not an account that can be accessed for general use or used to send files to a remote computer. Finally, not every file can be FTP'd. Only files that have a protection permitting transfer (i.e., allowing public read access) can be FTP'd anonymously.

Return to Contents


4.0 How does FTP connect to an Anonymous FTP site?

Each computer on the Internet has a unique Domain Name (host.domain.top-domain) and a corresponding IP Address (xxx.xxx.xxx.xxx with each xxx ranging from 0 to 255) associated with it as a means of identification. The ROHAN identification is rohan.sdsu.edu or 130.191.3.100. This address scheme tells network programs the location of a computer and on which network it resides. FTP uses either the remote computer's Domain Name or its corresponding IP Address to make a connection.


4.1 Finding a Domain Name or IP Address

There are a wide variety of books covering Internet issues including Domain Names and IP Addresses that can be obtained at most bookstores. New books are published each month and all can assist you with your explorations. Also see handout #0303 Internet Resources (available in BA-110, LL-200, at Malcolm A. Love Library, and on the web at URL -- http://rohan.sdsu.edu/0300series.html) for further sources.

Quite often the SDSU name server program may not be able to map a Domain Name (hupcap.clemson.edu) to its IP Address (130.127.28.32), but you can use either. If the SDSU name server program does not recognize the Domain Name and you don't know the corresponding IP Address, you can use a lookup program prior to executing FTP from ROHAN and obtain that information.

An example of host on ROHAN using two Internet sites, hubcap.clemson.edu and arthur.cs.purdue.edu, follows. The programs will look up either a Domain Name or an IP address on a single line command string or via the program > prompt for multiple inquiries.

On ROHAN:

rohan% host 130.127.28.32
32.28.127.130 IN-ADDR.ARPA domain name pointer hubcap.clemson.edu

rohan% host arthur.cs.purdue.edu
arthur.cs.purdue.edu has address 128.10.2.1
arthur.cs.purdue.edu mail is handled (pri=1) by arthur.cs.purdue.edu
rohan%

Return to Contents


5.0 Where are Anonymous FTP sites located?

At SDSU, there is a FTP archive located on rohan.sdsu.edu with doc, ibm, mac, and html directories and more under the /pub directory. To reach the WUARCHIVE mentioned earlier, you would FTP to wuarchive.wustl.edu. Many FTP sites can be accessed using the World Wide Web (WWW). Type in ftp and the address of the site. Login as ftp and use your complete Email address as the password. Files can be easily downloaded by clicking on the highlighted text. For further information on Anonymous FTP sites, refer to the handout #0303 Internet Resources (available in BA-110, LL-200 and on the web at URL -- http://rohan.sdsu.edu/0300series.html).

Return to Contents


6.0 How do I invoke FTP on ROHAN?

Log onto your computer account on ROHAN and issue the ftp command at the system prompt.

SunOS 5.8
 
This system is for the use of authorized users only.  Individuals using this
computer system without authority, or in violation of state or federal laws
are subject to having their activities monitored by law enforcement officials.
 
login:          <-- log onto ROHAN with your
password:  username and password
 
rohan%ftp <---- invoke FTP

Once in the FTP program, you open a session with the remote computer of your choice, login as anonymous and then issue a file command.

open domainname

Opens an FTP session on another host computer. In order to do this, you must know the computer's Domain Name or IP Address. The SUN Ultra Enterprise 4000 has a Domain Name of rohan.sdsu.edu, however rohan will suffice if you are using FTP from another computer on-campus. This is because the sdsu.edu part of the name refers to SDSU's domain, which on-campus computers assume as the default. When a Domain Name is used, your local computer obtains the IP Address from a Domain Name server. The IP Address should be used if the Domain Name does not succeed. Example: ROHAN has an IP Address of 130.191.3.100.

username

Prompts you to enter your account/username for the host computer. With Anonymous FTP, you would enter the appropriate public account/username, generally anonymous or ftp.

password

Prompts you to enter the password for the account/username entered. With Anonymous FTP, you would enter the appropriate password, generally your complete Email address.

get myfile

At this point, you are ready to issue an FTP file command. In this example, you are using the get command to copy a file named myfile from the remote host computer.

quit

Closes the session with the remote host computer and exits FTP.

Return to Contents


7.0 How do I open a new FTP session?

To log into another site, first close the current FTP session by issuing the close command. Then use the open command followed by the Domain Name or IP Address for the new remote computer. Following opens another FTP session run from ROHAN to 152.163.200.5:

ftp> close
221 Goodbye.
ftp> open rohan.sdsu.edu
Connected to rohan.sdsu.edu
220 rohan.sdsu.edu FTP server (Version wu-2.6.0(7) Thu Jun 29 15:28:49 PDT 2000) ready.
Name (rohan.sdsu.edu:johndoe): anonymous
331 Guest login ok, send your email address as password.
Password: jdoe@rohan.sdsu.edu  <-Your Email address
230-  Welcome to the San Diego State University anonymous ftp archive.
230 Guest login ok, access restrictions apply.
ftp> 

Return to Contents


8.0 What is Binary vs. ASCII?

Files found at Anonymous FTP sites can either be stored in ASCII mode (pure text files usually ending with either .txt or .asc) or non-text files stored in binary mode (also known as image mode [pictures, software, music, speech, word, etc.]). ASCII mode automatically adjusts the file during the transfer so that the file is a valid text file when it is stored on the receiving end. A binary file is left alone and transferred verbatim. Before downloading be sure to set the transfer mode to the proper type by typing or selecting ascii or binary prior to the get or mget command (See section 12.0 What FTP commands are available?). The FTP site should respond with type set to A or type set to I acknowledging your request.

If you accidentally transfer a binary file with the transfer mode set to ASCII, the file received will be corrupted and useless. However, the reverse will work fine. If you don't know the type of a file, set the transfer mode to binary. Then you're sure that your files will always transfer correctly.

In the following example, we will get the binary zip file ttermp23.zip (Terra Term Telnet Program) from an anonymous FTP session to rohan.sdsu.edu.

ftp> binary
200 Type set to I.
ftp> cd /pub/ibm
250-Please read the file README
250-  it was last modified on Fri Aug 15 10:59:50 1997 - 1112 days ago
250 CWD command successful.
ftp> get ttermp23.zip
200 PORT command successful.
150 Opening BINARY mode data connection for ttermp23.zip (943376 bytes).
226 Transfer complete.
local: ttermp23.zip remote: ttermp23.zip
943376 bytes received in 0.072 seconds (12744.91 Kbytes/s)
ftp> quit
rohan%

The files are now in your account. This file is in a compressed format, so it will have to be uncompressed before it can be used.

Return to Contents


9.0 What are compressed files?

Many files at Anonymous FTP sites are compressed so they occupy less space on their computers and facilitate faster transfer across the Internet. Compressed files have file extensions like .z, .gzip, .bin, .hqx, or .zip.

Such files must be locally decompressed. The decompressing program used depends on the type of data compression initially employed. For instance, files which end with .z can be uncompressed or extracted using the UNIX utilities uncompress, while files ending with .zip can be uncompressed using the WIN program WinZip. Below are operating systems and compressed file types with their associated programs.

Operating System

File Type

To Uncompress a File

To Compress a File

WIN

.zip

WinZip

WinZip

MAC

.bin, .hqx, .sit, .cpt, .sea, .seq, .pit, .dd, plus DOS (.zip, .lzh, and .arc), and UNIX (.z and .tar files)

Stuffit Expander

Stuffit Expander

UNIX

.gz

gunzip

gzip

UNIX

.z

uncompress

compress

A copy of the file compression program, pkzip (pkzip204.exe), can be downloaded for DOS/WIN PC users via Anonymous FTP to rohan.sdsu.edu from the /pub/ibm directory. For MAC users, a copy of Stuffit Expander (the file compression program) can be obtained using Anonymous FTP to wwwhost.ots.utexas.edu from the /pub/mac/compression/ directory. (The file name is stuffit-expander-401.hqx)

Return to Contents


10.0 What are tar files?

Sometimes the need to compress involves a group of files and becomes a two stage process. When it is necessary to bundle a group of files together for transfer, the UNIX program tar is used. tar can bundle programs (many related files) with their electronic manuals and maintain their directory and sub-directory configurations. Since it can bundle and unbundle but not compress, a compression program is used for the second stage. To alert users of its use, tar files traditionally have tar somewhere in their filename. If the tar file has been through both stages of the process, the filename might end in .tar.z (a compressed tar file).

To display the contents of a tarred file a screen at a time, enter:

tar tvf filename | more

where your file's name is substituted for filename in the above example command.

To untar a tarred file, type:

tar xvf filename

where your file's name is substituted for filename in the above example command.

Return to Contents


11.0 What microcomputer software offers FTP?

There are many software programs using TCP/IP protocols that can be used with an Internet connection. Following are some samples of software programs that offer FTP capabilities:

FTP Software Programs

WIN versions

MAC versions

WS_FTP (freeware for Windows 95)

Fetch (public domain pkg.) (Available from TNS)

When using one of the above software packages, refer to their documentation for a description of their installation and use. Also see handout #0303 Internet Resources (available in BA-110, LL-200, at Malcolm A. Love Library, and on the web at URL -- http://rohan.sdsu.edu/0300series.html) for additional information.

Return to Contents


12.0 What FTP commands are available?

Most commands used by the FTP program are similar to UNIX commands and most FTP sites are on UNIX-based computers. Typing ? at the FTP> prompt will produce a list of FTP commands.

FTP> ?

Commands may be abbreviated. Commands are:

!                     cr                      macdef   proxy               send
$                    delete       mdelete         sendport     status
account        debug              mdir        put                   struct
append         dir                     mget       pwd                  sunique
ascii              disconnect   mkdir        quit                  tenex
bell                form                 mls         quote               trace
binary           get                    mode      recv                  type
bye                glob                 mput      remotehelp   user
case              hash                 nmap      rename       verbose
cd                  help                  ntrans    reset                 ?
cdup             lcd                    open      rmdir
close             ls                      prompt   runique
 

Typing help command where command is replaced by one from the list will display a one line description of the command typed with usage requirements.

FTP> help remotehelp

remotehelp - get help from remote server

FTP> help reset

reset - clear queued command replies

Here are some FTP commands that will be helpful for almost all operating system environments.

ascii

Configures FTP to receive ASCII files (usually the default).

binary

Configures FTP to receive binary files (both test and binary files can be transferred in binary mode, so switching to this mode as soon as you start FTP won't hurt anything).

cd

Changes to a directory (depends on computer file structure).

cdup or cd ..

Changes directory up one level.

close

Closes an FTP session without quitting FTP.

delete

Deletes a file on the remote computer (needs the name of the file to follow command).

dir

Produces a more detailed listing of files on the remote computer where file names begin with a dash and directory names begin with the letter d.

exit

Closes an FTP session and quits FTP.

ftp

Starts an FTP session (see open command).

get

Copies (gets) a file from the remote to the local computer (needs the name of the file to follow command).

help

Provides a help listing; used with a command, it provides help on that command.

lcd

Changes local directory (send data to floppy drive).

ls

Produces a brief listing of files on the remote computer.

mdelete, mls, mput, & mget

Same as the delete, ls, put, and get commands except the "m" put in front of the commands allows an action on multiple files. For example: mget file1 file2 would get both file1 and file2 with one command. Entering mget would prompt you for the files. Wildcards can also be used. mput is generally not used during Anonymous FTP sessions.

mkdir

Creates a directory (depends on computer file structure)

open

Opens a session with a remote computer (needs the Domain Name or IP Address of the remote computer to follow command).

put

Copies (puts) a file from the local computer onto the remote computer (needs the name of the file to follow the command). Generally not used during Anonymous FTP sessions.

pwd

Displays the complete path of your present working directory on the remote computer (depends on computer file structure).

quit

Ends an FTP session.

rename

Renames a file on the remote computer (you are prompted for the new filename).

rmdir

Deletes a directory (depends on computer file structure).

user

Issues a user command (used for re-logging on to a remote computer in case initial logon fails).

For more detailed information, use the help function on your FTP program.