![]()
![]() |
FTP Quick Start
This document provides an overview of the use of FTP programs to transfer files between computers via a TCP/IP network, such as the Internet. It covers just the basics required to get started using FTP and is by no means a comprehensive reference. It includes a brief overview, a summary of the most useful commands and an example FTP session. FTP OverviewThe File Transfer Protocol (FTP) describes a way for computers to talk to each other when they want to transfer files between themselves. Most operating systems provide a basic FTP client program for connecting to remote FTP servers. It can normally be executed by typing 'ftp' at a command prompt. So, suppose you wanted to get a file stored on an (imaginary) remote server called whiz.bang.org onto your own computer. At a command prompt, you could make the connection by typing: $ ftp whiz.bang.org You might get a response like the following: $ ftp whiz.bang.org Connected to whiz.bang.org. 220 whiz.bang.org FTP server (Version wu-2.6.0(1) Thu Oct 21 12:27:00 EDT 1999) ready. User (whiz:(none)): The actual response will vary slightly, depending on the server and the client program you are using, but all servers proceed by asking you to login with a username and password. Once you have entered these, you are presented with the FTP prompt. ftp> _ At the prompt, you can enter a variety of commands related to working with files. You can get a list of the commands by entering 'help' (or a question mark). For a description of a specific command, type 'help' (or '?') followed by the command name: ftp> help Commands may be abbreviated. Commands are: ! debug mdir sendport site $ dir mget put size account disconnect mkdir pwd status append exit mls quit struct ascii form mode quote system bell get modtime recv sunique binary glob mput reget tenex bye hash newer rstatus tick case help nmap rhelp trace cd idle nlist rename type cdup image ntrans reset user chmod lcd open restart umask close ls prompt rmdir verbose cr macdef passive runique ? delete mdelete proxy send ftp> help get get Receive file ftp> ? mget mget Get multiple files FTP Command SummaryBrief descriptions of the most useful FTP commands are given below. Open/Close Session user [username] Send new user information. Allows you to re-enter your username and password, usually used when you make a mistake on the initial login. If this happens, you are still connected to the remote server but not logged in, so you should use the 'user' command to try again. open [hostname] Connect to remote ftp server. close Close connection to remote ftp server. bye Terminate ftp session and exit ftp. File Transfer Mode ascii Set ascii transfer type. Enables text-format conversion for transferring plain-text (.txt, .html) files between systems with different text-file formats (eg. Unix and Windows). This should never be used with any kind of binary format file (.exe, .doc, .zip, etc...) because the file created will be corrupted by the conversion. binary Set binary transfer type. Files will be transferred exactly byte-for-byte. Used for all non-text files or when both systems are the same (eg. unix->unix) or they use the same text-file format. hash Toggle printing '#' for each buffer transferred. Allows you to monitor the progress of a transfer by printing a '#' for each block of bytes that is sent or received. The size of a block is system- dependent (eg. Linux uses 1K, Windows uses 2K). prompt Toggle interactive prompting on multiple commands. In 'prompt' mode (usually enabled by default) ftp will prompt for confirmation before each file is transferred using a command like 'mput' or 'mget'. This prompting can be switched on or off using the 'prompt' command. Directories dir [path] List contents of remote directory. cd [path] Change working directory on the remote system. lcd [path] Change working directory on the local system. pwd Print current working directory on remote system. File Transfer get [filename] Get one file from the remote system. put [filename] Send one file to the remote system. mget [filespec] Get multiple files from the remote system. Eg. 'mget *.txt' will get all .txt files from the current directory on the remote machine. mput [filespec] Send multiple files to the remote system. Eg. 'mput *.zip' will send all .zip files from the current directory on the local machine. FTP Session ExampleBelow is a transcript of a typical FTP session with the imaginary whiz.bang.org server. In this example the user connects to the server using a facility provided by many FTP servers called 'anonymous FTP', which allows you to connect to a remote system as a guest in order to download publicly available files. To use anonymous FTP, you login with the username 'anonymous' and enter your email address as the password. $ ftp whiz.bang.org Connected to whiz.bang.org. 220 whiz.bang.org FTP server (Version wu-2.6.0(1) Thu Oct 21 12:27:00 EDT 1999) ready. Name (whiz:(none)): anonymous 331 Guest login ok, send your complete e-mail address as password. Password: 230 Guest login ok, access restrictions apply. ftp> dir 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 24 drwxr-xr-x 6 root root 4096 Feb 8 1996 . drwxr-xr-x 6 root root 4096 Feb 8 1996 .. drwxr-sr-x 2 root ftp 4096 Mar 21 1999 pub 226 Transfer complete. ftp> cd pub 250 CWD command successful. ftp> dir 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 1220 drwxr-xr-x 2 root root 4096 Feb 8 1996 . drwxr-xr-x 6 root root 4096 Feb 8 1996 .. -rwxr-xr-x 1 root root 1031004 Mar 21 1999 binary_file.exe -rwxr-xr-x 1 root root 33596 Mar 21 1999 text_file.txt 226 Transfer complete. ftp> ascii 200 Type set to A. ftp> get text_file.txt local: text_file.txt remote: text_file.txt 200 PORT command successful. 150 Opening ASCII mode data connection for text_file.txt (33596 bytes). 226 Transfer complete. 33643 bytes received in 0.00767 secs (4.3e+03 Kbytes/sec) ftp> binary 200 Type set to I. ftp> hash Hash mark printing on (1024 bytes/hash mark). ftp> get binary_file.exe local: binary_file.exe remote: binary_file.exe 200 PORT command successful. 150 Opening BINARY mode data connection for binary_file.exe (1031004 bytes). ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ ############################################## 226 Transfer complete. 1031004 bytes received in 0.362 secs (2.8e+03 Kbytes/sec) ftp> bye 221-You have transferred 1064647 bytes in 2 files. 221-Total traffic for this session was 1066979 bytes in 5 transfers. 221-Thank you for using the FTP service on whiz.bang.org. 221 Goodbye. $ |