Computer Science Department |
Basic FTP Commands |
ftp machinename
where machinename is the full machine name of the remote machine, e.g., purcell.cs.colostate.edu. If the name of the machine is unknown, you may type
ftp machinennumber
where machinennumber is the net address of the remote machine, e.g., 129.82.45.181. In either case, this command is similar to logging onto the remote machine. If the remote machine has been reached successfully, FTP responds by asking for a loginname and password.
ftp>
and permits you access to your own home directory on the remote machine. You should be able to move around in your own directory and to copy files to and from your local machine using the FTP interface commands given on the following page.
? | to request help or information about the FTP commands | |
---|---|---|
ascii | to set the mode of file transfer to ASCII (this is the default and transmits seven bits per character) | |
binary | to set the mode of file transfer to binary (the binary mode transmits all eight bits per byte and thus provides less chance of a transmission error and must be used to transmit files other than ASCII files) | |
bye | to exit the FTP environment (same as quit) | |
cd | to change directory on the remote machine | |
close | to terminate a connection with another computer | |
close brubeck | closes the current FTP connection with brubeck, but still leaves you within the FTP environment. | |
delete | to delete (remove) a file in the current remote directory (same as rm in UNIX) | |
get | to copy one file from the remote machine to the local machine | |
get ABC DEF | copies file ABC in the current remote directory to (or on top of) a file named DEF in your current local directory. | |
get ABC | copies file ABC in the current remote directory to (or on top of) a file with the same name, ABC, in your current local directory. | |
help | to request a list of all available FTP commands | |
lcd | to change directory on your local machine (same as UNIX cd) | |
ls | to list the names of the files in the current remote directory | |
mkdir | to make a new directory within the current remote directory | |
mget | to copy multiple files from the remote machine to the
local machine; you are prompted for a y/n answer before transferring each file | |
mget * | copies all the files in the current remote directory to your current local directory, using the same filenames. Notice the use of the wild card character, *. | |
mput | to copy multiple files from the local machine to the
remote machine; you are prompted for a y/n answer before transferring each file | |
open | to open a connection with another computer | |
open brubeck | opens a new FTP connection with brubeck; you must enter a username and password for a brubeck account (unless it is to be an anonymous connection). | |
put | to copy one file from the local machine to the remote machine | |
pwd | to find out the pathname of the current directory on the remote machine | |
quit | to exit the FTP environment (same as bye) | |
rmdir | to to remove (delete) a directory in the current remote directory | |
See also the SILS FTP Tutorial
Examples of two FTP sessions are given on the next two pages. These show the type of interaction you may expect when using the ftp utility.
% ftp cs.colorado.edu Connected to cs.colorado.edu. 220 bruno FTP server (SunOS 4.1) ready. Name (cs.colorado.edu:yourlogin): anonymous 331 Guest login ok, send ident as password. Password: 230-This server is courtesy of Sun Microsystems, Inc. 230- 230-The data on this FTP server can be searched and accessed via WAIS, using 230-our Essence semantic indexing system. Users can pick up a copy of the 230-WAIS ".src" file for accessing this service by anonymous FTP from 230-ftp.cs.colorado.edu, in pub/cs/distribs/essence/aftp-cs-colorado-edu.src 230-This file also describes where to get the prototype source code and a 230-paper about this system. 230- 230- 230 Guest login ok, access restrictions apply. ftp> cd /pub/HPSC 250 CWD command successful. ftp> ls 200 PORT command successful. 150 ASCII data connection for /bin/ls (128.138.242.10,3133) (0 bytes). ElementsofAVS.ps.Z . . . execsumm_tr.ps.Z viShortRef.ps.Z 226 ASCII Transfer complete. 418 bytes received in 0.043 seconds (9.5 Kbytes/s) ftp> get README 200 PORT command successful. 150 ASCII data connection for README (128.138.242.10,3134) (2881 bytes). 226 ASCII Transfer complete. local: README remote: README 2939 bytes received in 0.066 seconds (43 Kbytes/s) ftp> bye 221 Goodbye. % ls . . . README . . . |
% ftp nordsieck.cs.colorado.edu Connected to nordsieck.cs.colorado.edu. 220 nordsieck FTP server (Version 5.53 Tue Aug 25 10:46:12 MDT 1992) ready. Name (nordsieck.cs.colorado.edu:yourlogin): yourlogin 331 Password required for yourlogin. Password: 230 User yourlogin logged in. ftp> cd HPSC/exercises 250 CWD command successful. ftp> ls 200 PORT command successful. 550 No files found. ftp> put tmul.out 200 PORT command successful. 150 Opening ASCII mode data connection for tmul.out. 226 Transfer complete. local: tmul.out remote: tmul.out 1882 bytes sent in 0.0095 seconds (1.9e+02 Kbytes/s) ftp> ls 200 PORT command successful. 150 Opening ASCII mode data connection for file list. tmul.out 226 Transfer complete. 9 bytes received in 0.0021 seconds (4.3 Kbytes/s) ftp> mput * mput Makefile? y 200 PORT command successful. 150 Opening ASCII mode data connection for Makefile. 226 Transfer complete. local: Makefile remote: Makefile 1020 bytes sent in 0.0062 seconds (1.6e+02 Kbytes/s) mput tmul.out? n ftp> quit 221 Goodbye. % ls . . . Makefile tmul.out . . . |