File Transfer Protocol
A protocol permitting a user on one Internet host to access and transfer files to another host over a network, such as the Internet. FTP is usually the name not only of the protocol, but also of the program the user invokes to execute the protocol (e.g., ftp host.bbn.com). This protocol is usually layered on top of TCP and IP (see TCP/IP). FTP is available on several operating systems. You can use the ftp command to copy computer files that contain a variety of information, such as software, documentation, or maps.
Public archives (storehouses) of data, information and software is available from anonymous FTP sites. Accessing these sites requires access to the Internet. Under windows, use "ftp_win32" to connect to anonymous sites. From your UNIX account, type
At the response, type
at the "to:" prompt, enter the address of the computer you want to go to. Here are some useful addresses:
The first address is to get the latest version of Netscape, the second to get the latest version of Hot Java. The other two are sites which house free software, especially for windows (including internet software). You can get tcp, telnet, ftp, archie and gopher programs from these sites.
At the login prompt, type "anonymous," and at the "password" promt type your e-mail address (e.g., email@example.com). Typically, you will go into the "pub" (i.e., public) directory.
You can also ftp in dos by selecting the "Communications" option from the DOS Menu in Instruct. Select "NCSA FTP" and follow instructions.
As an example, copy "win.ini" to your c:\temp directory (i.e., type "copy c:\windows\win.ini c:\temp\win.ini"
Then get into Instruct (DOS Menu), select "COMMUNICATIONS" and "NSCA FTP"
At the to: prompt, type
Enter your login and password for CUNIX
Once you are logged in, type
- login: you (i.e., your CUNIX address before the @ sign)
- password: your cunix password
which will change the local directory (i.e., on your PC) to
- lcd c:\temp
to create a directory called "public_html" in your CUNIX account (you will need this directory later; if you make an error, type "rmdir dirname" and try again.
- mkdir public_html
to enter the public_html directory.
- cd public_html
which you need to transfer programs (you don't need to here, but do so just the same). Then type
After the transfer occurs, type "dir" or "ls" (for "list," which is the same as "dir"). You should see the file "win.ini"
- put win.ini
which will change the PC directory to C:
- lcd c:
This will transfer win.ini under C: on your PC (so now you should have win.ini in three places on your computer: under C:, in C:\temp, and in C:\windows. Later, should delete the files in the first two locations later; i.e., "del c:\win.ini" and "del c:\temp\win.ini").
- get win.ini
Try using "mget *.ini" instead of "get win.ini." Similarly, try "mput *.ini" instead of "put win.ini" See what happens.
Type "bye" when you are finished.
In summary, there are generally five steps to pulling files from an archives:
- recv remote-file [ local-file ] A synonym for get.
- remotehelp [ command-name ] Requests help from the remote FTP
- server If a command-name is specified it is supplied to the server as well.
- rename [ from ] [ to ] Renames the file from on the remote machine, to the file to.
- reset Clears the reply queue. This command re-synchronizes command/reply sequencing with the remote ftp server. If the remote server violates the ftp protocol, resynchronization may be neccesary.
- rmdir directory-name Deletes a directory on the remote machine.
- runique Toggles storing of files on the local system with unique filenames. If a file already exists with a name equal to the target local filename for a get or mget command, a .1 is appended to the name. If the resulting name matches another existing file, a .2 is appended to the original name. If this process contin ues up to .99, an error message is printed, and the transfer does not take place. The generated unique filename will be reported. Note that runique will not affect local files generated from a shell command (see below). The default value is off.
- send local-file [ remote-file ] A synonym for put.
- sendport Toggles the use of PORT commands. By default, ftp attempts to use a PORT command when establishing a connection for each data transfer. If the PORT command fails, ftp uses the default data port. When the use of PORT commands is disabled, no attempt is made to use PORT commands for each data transfer. This is useful for certain FTP implementations which do ignore PORT commands but, incorrectly, indicate that they have been accepted.
- status Shows the current status of ftp. struct [ struct-name ] Sets the file transfer structure to struct-name. By default stream structure is used.
- type [ type-name ] Sets the file transfer type to type name. If no type is specified, the current type is printed. The default type is network ASCII.
- user user-name [ password ] [ account ] Identifies the user to the remote FTP server. If the password is not specified and the server requires it, ftp disables the local echo and then prompts the user for it. If an account field is not specified, and the FTP server requires it, the user is prompted for it also. Unless ftp is invoked with auto login disabled, this process is done automatically on initial connection to the FTP server.
- verbose Toggles the verbose mode. In verbose mode, all responses from the FTP server are displayed to the user. In addition, if verbose is on, statistics regarding the efficiency of a file transfer are reported when the transfer is complete. By default, verbose is on.
- ? [ command ] A synonym for help. Command arguments which have embedded spaces may be quoted with quotation (") marks.
- Aborting a file transfer To abort a file transfer, use the terminalinterrupt key (usually
). Sending transfers are halted immediately. Receiving transfers are halted by sending a ftp protocol ABOR command to the remote server, and discarding any further data received. The speed at which this is accomplished depends upon the remote server's support for ABOR processing. If the remote server does not support the ABOR command, an ftp> prompt appears when the remote server has completed sending the requested file. The terminal interrupt key sequence is ignored when ftp has completed any local processing and is awaiting a reply from the remote server. A long delay in this mode may result from ABOR processing, or from unexpected behavior by the remote server, including violations of the ftp protocol. If the delay results from unexpected remote server behavior, the local ftp program must be killed by hand.
- status checks your file type.
- list (ls) causes the remote computer to print a list of available subdirectories and files. Below is an exercise that will show you how to change directories and transfer a file from a subdirectory. The commands you will type are printed in bold italics.
- To ftp text files, including files that end in ".txt" or ".ps", your file can be ASCII (but "binary" does no harm, except that it takes longer). This is the default. (The ASCII setting is the same as TEXT.)
- The cd command is used to change directories on the remote host.
- Transfer to your computer with ftp (using a text-only option).
- If necessary, combine the parts.
- Transfer to your computer.
- If a file is compressed, use the appropriate decompression program (usually winzip) decompress it.
- If you have downloaded a program (usually to c:\temp"), run "setup.exe" or "install.exe" after unzipping the files.