----> FTP Tutorial <---- --> Rev. 4 <-- Chris Alfeld - calfeld@east.east.slc.k12.ut.us Legal Guck: You are free to distribute this guide unmodified in any non-profit way. If you would like to modify it, or distribute it for a profit (CD-ROM, etc..). Please ask me (address above). Archives: ftp://ftp.east.slc.k12.ut.us/calfeld/ http://www.math.utah.edu/creations/ gopher://gopher.east.slc.k12.ut.us/1/Guides/ ---------------------------------------------------------------------- [ Table of contents ] 1: Introduction 2: Tutorial 3: Reference [[ Section 1: Introduction ]] FTP is a method of transferring files between two computers. Unfortunately the client for ftp (known as 'ftp') is rather cryptic and unfriendly. It is the purpose of this guide to make that client usable to the common user. It is important to realize the basics of how FTP work. A computer runs the ftp client to connect to another computer. The computer running the client is known as the 'client', and the computer being connected to is known as the 'host'. What is important is that while the client is being used by a human, the host has no human interaction. In other words, you only need one human to transfer files, not two (one on each end). Text that will be displayed to your screen will be start and end with a line of -'s. Section 2 is a step by step example of FTP, and Section 3 is a reference for common ftp commands. [[ Section 2: Tutorial ]] 1: Make sure you are at the system prompt. 2: Enter the command 'ftp'. -------------------------------------------------------------------------------- ftp> -------------------------------------------------------------------------------- 3: Enter the command 'open ftp.std.com'. The command 'open' tells ftp to open a connection to a host. The argument is the host to open, in this case ftp.std.com. -------------------------------------------------------------------------------- Trying 192.74.137.7... Connected to ftp.std.com. 220 ftp FTP server (Version wu-2.4(3) Thu Apr 14 16:20:44 EDT 1994) ready. Name (ftp.std.com:calfeld): -------------------------------------------------------------------------------- What you see on your screen will differ somewhat from what is above. 4: Enter 'anonymous' as your "Name". 'anonymous' is a username used to connect to public ftp sites. If you were connecting to a computer on which you had an account you would use your username instead. -------------------------------------------------------------------------------- 331 Guest login ok, send your complete e-mail address as password. Password: -------------------------------------------------------------------------------- 5: Enter your e-mail address for your password. If you were connecting to a host where you had an account you would use your password instead. -------------------------------------------------------------------------------- 230- 230-Hello! 230- 230-This is the anonymous FTP area for world.std.com, a public access Unix 230-system. Accounts directly on the system are available via telnet or 230-direct-dial (617-739-9753, 8N1, V.32bis (14.4K), V.32 (9600), 2400, etc.), 230-login as new (no password) to create an account. Accounts are charged 230-at $5/mo+$2/hr or $20/20hrs/month, your choice. Grab the details in 230-the world-info directory here if interested. 230- 230- 230-Please read the file README 230- it was last modified on Tue Apr 5 22:43:01 1994 - 88 days ago 230 Guest login ok, access restrictions apply. ftp> -------------------------------------------------------------------------------- This was what is shown to guests who log in on July 2nd, 1994. By the time you read this guide it may well have changed. 6: Ok, now that you have connected lets look around. Type 'ls' to see what's in this directory. -------------------------------------------------------------------------------- 200 PORT command successful. 150 Opening ASCII mode data connection for file list. obi pub customers lost+found amo AW ..... bcs bmug .find.codes README books associations 226 Transfer complete. 282 bytes received in 0.09 seconds (3.1 Kbytes/s) ftp> -------------------------------------------------------------------------------- Note: not all output is shown. 7: Ok, now this shows you what's in the directory but it's not very nice. Try 'ls -CF' instead. the flags '-C' means to output in columns, and '-F' means mark directory with a /, executables with a *, etc.. (see ls in UnixGuideII) -------------------------------------------------------------------------------- 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. .find.codes Softpro@ bin.sparc/ epimbe@ periodicals@ .obs/ WWW/ bmug@ etc/ private/ AW@ amo@ books@ ftp@ pub/ Kluwer@ archives@ community@ gopherdir/ src/ OBS/ associations/ consultants@ lost+found/ vendors@ Quantum@ bcs@ customers/ nonprofits@ world-info/ README bin/ dist/ obi/ 226 Transfer complete. remote: -CF 302 bytes received in 0.059 seconds (5 Kbytes/s) ftp> -------------------------------------------------------------------------------- Much better. 8: Ok, lets try and find a file to grab. Usually the 'pub' directory is a good place to look so enter the command 'cd pub'. -------------------------------------------------------------------------------- 250 CWD command successful. ftp> -------------------------------------------------------------------------------- 9: Now enter the 'ls -CF' command again. -------------------------------------------------------------------------------- 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. .cache* demo/ onset/ ADLLib/ dhb/ patent@ Able/ dmh/ paz@ BUSVIEW.ZIP dougmac/ plutonium/ ... daveap.ani mpeg/ x102sun.tar davelr.ani oakridge/ 226 Transfer complete. remote: -CF 1585 bytes received in 0.56 seconds (2.8 Kbytes/s) -------------------------------------------------------------------------------- Note: Not all output is shown. Gad that's a lot. 10: Ok, now let's go get a file. Enter the command: 'cd MenuDropper' and then 'ls -l'. The -l flags causes ls to output more information about the file. (See ls in UnixGuideII) -------------------------------------------------------------------------------- 250 CWD command successful. ftp> ls -l 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 446 -rw-r--r-- 1 3639 3639 206542 Aug 25 1993 MenuDropper_7.1b8a.cpt.hqx -rw-r--r-- 1 3639 3639 6475 Aug 25 1993 MenuDropper_ReadMe.txt 226 Transfer complete. remote: -l 155 bytes received in 0.035 seconds (4.3 Kbytes/s) ftp> -------------------------------------------------------------------------------- 11: Ok, you'll probably only be interested in the name, date, and size of the files you see (6475 Aug 25 1993 MenuDropper_ReadMe.txt). The rest deals with the security of the file, and how many names it has (sounds crazy but true). 206542 is a little large especially since we don't know if we can use it, so let's get the ReadMe file instead. Enter the command 'get MenuDropper_ReadMe.txt'. Note: DOS users should use the command 'get MenuDropper_ReadMe.txt MDREADME.TXT' -------------------------------------------------------------------------------- 200 PORT command successful. 150 Opening ASCII mode data connection for MenuDropper_ReadMe.txt (6475 bytes). 226 Transfer complete. local: MenuDropper_ReadMe.txt remote: MenuDropper_ReadMe.txt 6600 bytes received in 1.5 seconds (4.3 Kbytes/s) ftp> -------------------------------------------------------------------------------- Note: Output will probably be somewhat different. 12: You now have the file 'MenuDropper_ReadMe.txt'. To view it quit ftp with the 'quit' command (you can also use 'bye' if you want to be friendly), and then use your favorite text editor or viewer to look at the file. 13: You have now completed the tutorial section of this guide. I suggest you read the following reference section and then experiment on your own. Also check to see if the program 'ncftp' is on your system. ncftp is a more friendly and powerful ftp client. [[ Section 3: Reference ]] Note: Variable argument are enclosed in "<>", option arguments are enclosed in "[]". ! [] - Shell escape. This command, if specified with no argument, will put you in a shell. Type 'exit' to return to ftp. If an argument is specified that command is run as if you had typed it at the shell prompt, it's output is displayed and then you are returned to ftp. Note: To run commands that require input use the ! command without an argument. mkdir,rmdir,rm,rename - These commands allows you make/delete directories, remove files, and rename files. See mkdir, rmdir, rm, and mv in UnixGuideII quit,bye - Exit ftp. close - close the current connection without exiting ftp. open - Try and connect to user [] - Specify a username to log in as. Will prompt you if no argument. This is used if you enter the wrong username or password. pass - Prompts you for a password to enter. Used if you enter the wrong password. help [] - Get one-line help on command or list of commands if no argument. ? - Same as help. ls [] [] - identical to the unix ls command. No wildcards though. See UnixGuideII for info on ls. pwd - Display what directory you are in (host directory). lcd [] - Change your local directory. If no arguments shows what your local directory is. Note: files are received to your local directory. Note2: !cd does not work because it looses the information when the shell quits (there is a more technical explanation but I will not go into it now.) put [] [] - Send a file to host. If no arguments then ftp will prompt you from local and remote files. If no remote_file specified then it will use the local_file as both. mput - This will send multiple files to the host. get [] [ - Receive a file from the host. See put. mget - Receive multiple files from the host. prompt - toggles whether to prompt for each file in mput and mget. ascii, binary - change the file transfer type. ascii for text files, binary for other files. cd - change to directory . ******************************************************************************** Please send comments/question/requests to calfeld@east.east-slc.edu Feel free to distribute this document as long as it is unmodified and no profit is gained by its distribution. If you wish to distribute it otherwise (cd-rom, etc..) contact me. Special thanks to world.std.com for letting me use their ftp site as an example. Chris Alfeld (calfeld@east.east-slc.edu)