Abstract: The FTP on UNIX requires the user to type in commands. See General FTP Commands for a description of the ones most commonly used. The examples below shows the use of some typical FTP commands.
UNIX FTP is fairly verbose and gives the user a lot of information about what it is doing in response to what the user types. Most responses are in two forms: an echo of what you type and a message following a message number. The message may be several lines long and warnings of errors may be buried. Watch carefully. The system also displays prompts for commands and passwords as well as banners for entry into and exit out of the program. The following sample FTP session illustrates much of this. The sample FTP session is preceeded by a list of conventions used in the sample.
- Bold text - what the user types in
- Plain text - the system response
- Comments - text following the symbol #are comments and should not be typed.
> ftp cunix.cc.columbia.edu #start session to cunix Connected to cunix.cc.columbia.edu. 220 tere FTP server (Version 5.60) ready. Name (cunix.cc.columbia.edu:sz2009): sz2009 #type your login name 331 Password required for sz2009. Password: #password invisible 230 User sz2009 logged in. ftp> cd work #change to sub-directory work 250 CWD command successful. ftp> dir #check files in directory 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 288 -rw-rw----1 us 1080 Jul 18 13:52 pluralty.dat -rw-rw-r--1 us 806 Jul 18 13:52 seafood.dta -rw-------1 us 5471 Jul 18 13:51 sur1.sps -rw-------1 us 288 Jul 18 13:51 sur2.sps -rw-rw----1 us 118000 Jul 18 13:51 survey.dat -rw-------1 us 58 Jul 18 13:53 update.dat 226 Transfer complete. 406 bytes received in 0.067 seconds (5.93 Kbytes/s)
ftp> get survey.dat #get the file survey.dat 200 PORT command successful. 150 Opening ASCII mode data connection for survey.dat (118000 bytes). 226 Transfer complete. local: survey.dat remote: survey.dat 119000 bytes received in 0.12 seconds (969.00 Kbytes/s)
ftp> mget *.sps #get all files with extension sps mget sur1.sps? y #type yes if you want this file #no, if you don't 200 PORT command successful. 150 Opening ASCII mode data connection for sur1.sps (5471 bytes). 226 Transfer complete. local: sur1.sps remote: sur1.sps 5635 bytes received in 0.044 seconds (124.46 Kbytes/s) mget sur2.sps? y #prompt for next file 200 PORT command successful. 150 Opening ASCII mode data connection for sur2.sps (288 bytes). 226 Transfer complete. local: sur2.sps remote: sur2.sps 310 bytes received in 0.028 seconds (10.70 Kbytes/s)
ftp> binary #set mode to binary for STATA dataset 200 Type set to I. ftp> get seafood.dta local: seafood.dta remote: seafood.dta 200 PORT command successful. 150 Opening BINARY mode data connection for seafood.dta (806 bytes). 226 Transfer complete. 806 bytes received in 0.0012 seconds (6.8e+02 Kbytes/s)
ftp> quit #end ftp session 221 Goodbye.Sometimes you may mistype the server name. In such a case, the FTP client will not be able to open a connection. You will have to re-enter the server name as in the example below:
ftp cunx #server name mistyped cunx: unknown host ftp> open cunix #try to connect again Connected to cunix.columbia.edu. 220 sawasdee FTP server (Version 5.60) ready. Name (cunix.cc.columbia.edu:sz2009): #proceed with your login name and password #as in the previous exampleIt may also happen that you mistype your username or password. In this case, the remote system will not let you in. You will have to re-enter your login name and password using the user command.
ftp cunix #start session to cunix Connected to cunix.columbia.edu. 220 sawasdee FTP server (Version 5.60) ready. Name (cunix.cc.columbia.edu:sz2009): s1z #type your login name 331 Password required for s1z. Password: #password invisible 530 Login incorrect. #your login name or password mistyped Login failed. ftp> user #type "user" to re-login (username) sz2009 #type your login name 331 Password required for sz2009. Password: #password invisible 230 User sz2009 logged in.

