Last changed: 10 March 1999 ftp help file FTP is the File Transfer program used to transfer files between two computers. The local computer is the computer on which you start FTP (_e.g._ nyx.nyx.net). The remote computer is the computer to which you connect (hostname in the command ``ftp hostname'' or ``open hostname''). Since most of the FTP commands relate to either the local or remote computer, this distinction is important. To start FTP, type ftp hostname where hostname is a logical name (_e.g._, nyx.nyx.net) or numeric address (206.124.29.1). When the connection is made, prompts for username and password will appear before logging in. The ftp> prompt will appear at this point. For anonymous ftp sites (_e.g._ ftp.uu.net), the username is usually ``anonymous'' or ``ftp'' and the password is your e-mail address (_e.g._ postmaster@nyx.net) If the connection fails because of an error in specifying hostname, typing open hostname will open a connection to hostname. This command also allows you to open a connection if a connection is closed due to timing out. If the login fails, typing user username will start the login for username, prompting for a password. Although is used to indicate the key, your keyboard may use the key for the same purpose. Changing directory: ------------------- After successfully logging in, the current directory is usually the home directory of the user. To change the current directory on the remote computer, type cd directory-name To change the current directory on the local computer, type lcd directory-name Listing a directory: -------------------- To get a listing of the current directory on the remote computer, type ls Because the listing may be long (and versions of FTP do not support pipes), it is useful to download the directory listing (often available at anonymous ftp sites) or to save the directory listing to the file output-file, type ls output-file or ls . output-file and the directory listing will be written to the file output-file on the local computer. To get a listing of the current directory on the local computer, type !ls [Note: this is actually a specific example of the shell escape command.] File type for transfer: ----------------------- FTP supports ASCII (text) and binary file types. Use ASCII transfer mode _only_ when transferring text files (_e.g._ source code, unformatted documents); all others should use binary transfer mode. When in doubt, use binary transfer mode. Since many versions of FTP initially the file type to ASCII, type status to make sure that you are using the proper mode. To select ASCII (text) transfer mode, type ascii To select binary transfer mode, type binary Uploading/downloading a file: ----------------------------- To download a file (transfer from remote computer to local computer), type get remote-file local-file or simply get remote-file if the filename of the local file is the same as the filename of the remote file. To upload a file (transfer from local computer to remote computer), type put local-file remote-file or simply put local-file if the filename of the remote file is the same as the filename of the local file. Opening/closing a connection: --------------------- To open a FTP connection, type open hostname To close a FTP connection, type close Quitting: --------- To quit FTP, type quit Quoting filenames/directories: ------------------------------ Since FTP allows file transfers to/from machines not running Unix (_e.g._, VMS, MacOS, Microsoft Windows), directory and file names may contain spaces and other characters that are special to the Unix shells. In order to use them with FTP commands, the names should be enclosed in quotes (' or "). For example, to change to the directory ``My Folder'' (embedded space) on the remote machine, type cd 'My Folder' Getting help: ------------- Typing help gives a list of the available FTP commands. Typing help command gives a short description of the command. As with all Unix commands, man ftp will display the man pages for FTP. Summary of commands: -------------------- ftp -- starts FTP program cd -- change current directory on the remote computer lcd -- change current directory on the local computer ls -- gets a directory listing on the remote computer !ls -- gets a directory listing on the local computer ascii -- selects ASCII (text) transfer mode binary -- selects binary transfer mode get -- downloads/retrieves file from the remote computer to the local computer put -- uploads/transfers file from the local computer to the remote computer open -- opens a FTP connection to the remote computer close -- closes a FTP connection to the remote computer user -- logs in as a user on the remote computer quit -- quits FTP program help -- online help