ftp ftp is the mla (multi-letter acronym) for File Transfer Protocol, a very important part of the TCP/IP suite of protocols. It allows you to transfer any sort of file from any of thousands of remote computer systems to your own. You can transfer executable computer programs, grpahics, sound, video or any other sort of files from remote archives to your own Internet host computer. And it's all free. Which Way Is Up? When you transfer a file from a remote computer to your own, you say "I downloaded a file." When you transfer from your own computer to another one, you say "I uploaded a file." Down = to you; Up = away from you. These terms can be con- fusing. It is even more confusing when you dial in to the Internet, because downloading will bring the file to your Internet host computer, not to your home PC or MAC. There is another step involved in downloading the file once again to your home computer. I Wish To Remain Anonymous As with telnet, the restriction to using remote computers is that you must have authorization to use them (an account, a user ID and a password). FTP gets around this problem by allowing a service called "anonymous ftp." That is, when you connect to a remote computer that allows anonymous ftp you enter your user ID as "anonymous." When asked for a password enter your full email address, eg: efudd@coyote.csusm.edu. Some systems verify your email address, some do not, but in any event it is proper netiquette to provide it to the remote host. Ye Be Properly Warned Says I Two warnings about ftp. 1) Once you see all the goodies you can get with ftp you are likely to go crazy and download way more than you can ever look at or use. Practice restraint. If you are working under a disk quota system (you probably are) you will rapidly exhaust your disk space alloca- tion, or exasperate the system administator, or both. 2) Many ftp archives do not check their offerings for viruses. Before running any ftped file scan it with a good, current virus checker. The best one around is shareware from McAfee. Ftp it from mcafee.com. ftp ftp ftp allows access to the world's largest library--the library of freely available computer files spanning thousands of computers. To start ftp type the command ftp followed by the address of the host to which you wish to connect. For example, ftp mcafee.com Many ftp servers are set up separately on the Internet, so their address looks like ftp.spies.com. Therefore the com- mand to connect to ftp.spies.com is: ftp ftp.spies.com. This is confusing, but that's the way it is. Logging In To An ftp Host When you make connections with an ftp host, the host will ask for your name with a prompt like: Name(mcafee.com:efudd): This is where you type "anonymous," even though the host knows who you are. When it asks for a password, enter your full email address. It will not echo the password to the screen so type carefully. Be sure to read the informational screen that appears next. These screens are usually VERY important. The Rules Change Once on an ftp host, the commands for file handling change from the unix commands on your home computer. To see a listing of files in a certain directory enter: dir, not ls as in unix. To change to a certain subdirectory enter: cd [name of subdirectory]. Subdirectory paths are separated (as in Unix, but not in DOS) with forward slashes. For ex- ample to change to the directory /pub/win3 enter: cd pub/win3. If the file you want is a binary file (a computer program, graphic, sound, or other non-text file) you must enter the command image (or i for short) first. You will see the message File Type set to I. This is critical. Getting Stuff To get a file, enter the command get [filename]. To get a group of files with similar names enter the command mget [filename pattern]. For example, to get all the files in a directory with the file extension .zip you would enter the command: mget *.zip. (Careful. This would probably do more than you think and download a ton of files). Let's practice these concepts with a sample ftp session. We are going to simulate getting that antivirus program from McAfee Associates mentioned above. Press PgDn to log in and start the ftp session... Archie The quantity of free software available via anonymous ftp is truly vast, but if you don't know where a program is located, how do you find it? Answer: archie. Archie is a program that searches the "Internet Archive Database" (which is up- dated about weekly). It will look for exact or partial matches to program names that you supply and report back to you the program's location. Then you can ftp to that site and obtain the program. Archie also has a whatis service, which searches a much smaller database of program descrip- tions. Archie has been called the card catalog to the largest library in the world. Using Archie You begin by telnetting to a public archie server. The printed summary to this lesson has a list of them, as does the resource section of this program. Log in as archie. You will see the archie> prompt. To see a summary of available commands enter: help ?. To use archie you must first set it up. There are a number of parameters that you should set--and different archie servers use different defaults--so you need to check. To see them enter the command: show. Archie Parameters There are three types of archie parameters: boolean, numeric and string. (Don't let the weird terminology throw you!) Boolean parameters will either be set or not. The one you care most about is one called "pager." When pager is set, the output of archie is delivered one screen at a time, using the paging program called "less." If pager is not set, and you want it set, enter the command: set pager. The numeric para- meter you care most about is "maxhits." It controls the number of "hits" returned by the search. It is usually set to 100 when you begin. You should set it to a smaller num- ber, like 10. Entering the command "set maxhits 10" is what you should do. More Parameters String parameters are parameters that have word values-- "string" is computerese for "word." The two most important are the "search" and "sortby" parameters. You should set the search parameter to "sub." (Set search sub, is the command). This instructs archie to search for a partial match to the search term you enter. The other important string parameter is the sortby parameter. You can set it to filename, hostname, size, date, time, or none, depending on how you want to see your output. If you are going to be doing a lot of archie searching you should also set the "mailto" parameter with your email address. That way when you issue the mail command you will not have to enter it. Searching To search with archie issue the command: find [searchterm]. Different archie servers run different versions of the archie software, however, and some do not recognize the "find" command. (It is newer). If this is the case with the server you are using use the "prog" command instead. Archie was originally designed to find programs only (thus "prog"), but archie now searches for many types of documents in addition to programs, so newer versions of the software have changed the command to "find." Once you have issued this command, be prepared for a wait. Archie servers are very busy and the searches can take substantial time. To break out of a search before it is finished press Control-C. Output If pager is set you can review your archie output one screen at a time, browsing back and forth using the "less" program commands. (Less has numerous commands. From archie you can read about them by entering the command: man less, and then mailing the results to yourself.) The two less commands you must know are: spacebar = show next page; q = quit. Once your output has been displayed you can mail it to yourself by issuing the "mail" command. If you have not set the "mailto" parameter you will have to enter your email address each time you issue the mail command. Now that you know it all, let's practice... File Types This lesson may seem particularly technical, but it is unavoidably so. If you are using ftp to get files from archived sites, or downloading files from Usenet newsgroups, you will come across a bewildering variety of archived, compressed, zipped and encoded files. To get the real benefit of using the Internet you need to understand how to work with these file types. The aim of this lesson is to clarify the difference between these vaious file types and to tell you how to handle them. Compressed Files A compressed file is one that has been squeezed to a smaller size by use of a program that uses special compression algo- rithms. Why? So that it will take up less space to store and transfer the file. Before it can be a useful file again, however, it has to be unsqueezed and restored to normal. So for every compression program there is an uncompress program. In fact two of the most common Unix utilities for squeezing and unsqueezing files are called "compress" and "uncompress." Other compression programs you need to know about are gzip/gunzip, pkzip/pkunzip, and a utility called zcat, which allows reading of compressed files before they are uncom- pressed. Gzip is for unix. Pkzip for MS-DOS files. Archived Files An archived file is a file made up of several other files all strung together. Many programs are actually not a single file but a system of files including program, graphics, data, and text files. To store and keep track of so many files is difficult, so they are archived together into a single file for storage and transfer purposes. In unix the archiving utility is called "tar" (which means tape archive program). It's MS-DOS relative is the same pkzip mentioned above. pkzip both compresses AND archives. Bear in mind however, an archived file is not necessarily a compressed file. In fact the tar program does not perform compression. File Extensions Because you can't tell from a superficial look at a file whether it is compressed, archived, both or neither, certain naming conventions have been established. A cryptic "file extension" (one or more letters following a period appended to a file name) indicates what has been done to the file. If a file has been archived with the unix tar program it has a file extension of ".tar." If it has been compressed with the compress program it has a file extension of ".Z." If it has been compressed with the gzip program it has a file extension of ".gz," unless it is specifically an MS-DOS file in which case it has the extension of ".z." If it has been archived/compressed with pkzip it's extension is ".zip." Some Examples, Please filename.tar - A group of files archived into one file using the unix "tar" program. filename.Z - A single file compressed using the unix program "compress." filename.tar.Z - A file which was first a group of files archived into a single file with "tar" and then compressed with "compress." filename.zip - A file compressed with the MS-DOS program "pkzip." Archive (.tar) Files To archive a group of files from the unix prompt enter the following command: tar -cvf filename.tar file1 file2 file3 ... Note the unix switches after the tar command. The c means "create" an archive, the v means report back "verbosely," and the f means the name of the archive is immediately "following." After the .tar file name enter the names of the files to be archived, separated by spaces. To unarchive a tar file, use this command: tar -xvf filename.tar The x means "extract." Tar will not remove the original file. Compress (.Z) Files To compress a file enter this command: compress filename where filename is the name of the file you want compressed. The results will be a file called: filename.Z. The original file will be removed. To uncompress this file: uncompress filename.Z The results will be an uncompressed file without the ".Z" extension. The original compressed file will be removed. To read a .Z (or .gz) file before it is uncompressed use the unix utility zcat if the file is a compressed text file. Zcat won't help if the file is a binary file. Archived Compressed Files (.tar.Z) Files which have been both archived and compressed with the unix "tar" and "compress" utilities will be called: filename.tar.Z (or .gz, if gzip was used). MS-DOS files are processed in this way using the pkzip program. They have a file extension of ".zip." The unix programs tar and compress/uncompress are standard on unix systems and you will have access to them if your host is a unix computer. Pkzip/pkunzip are MS-DOS programs distrib- uted as shareware, like this program, which means you can get it and use it free, and if you like it must send the author a small fee. You can get pkzip from most any ftp archive. Uuencoded Files Usenet news and standard unix mail work only with text files, so if you want to mail a binary file, or post a binary file to a Usenet news group, you must first convert it to a text file. This is what the program uuencode does. Uuencoded files are often given the file extension ".uue." To decode the file on the other end use the unix program uudecode. Uedecode does not remove the original encoded file from your directory after decoding. Another unix program that does the same job is "btoa" (binary to ascii). To go the other way use the command: btoa -a filename. Tarmail Many unix installations offer a program that will archive, compress, and mail (using standard unix mail's SMTP) a set of files all with one command. It is called "tarmail." For example, tarmail fudd@tel.com 'This Is It' file1 file2 file3 ... The part within the single quotes becomes the mail subject line. When you receive tarmailed mail first save it to a file, and then issue the command: untarmail filename. There is a great deal more that could be said about file types, but your head is probably already spinning. This lesson's printed summary will help you further.