The Basic FTP Commands – Cheat Sheet

FTP logo

FTP logo

The FTP (File Transfer Protocol) utility program is commonly used for copying files to and from other computers. These computers may be at the same site or at different sites thousands of miles apart. FTP is a general protocol that works on UNIX systems as well as a variety of other (non-UNIX) systems.

Most operating systems and communication programs now include some form of an FTP utility program, but the commands differ slightly between them. Most computers today include a windows-based type FTP program that is more PC-oriented and does not require full knowledge of these commands. You can also perform FTP through a browser. For example, bring up Internet Explorer and type in

ftp://yourLoginName@IPaddress

instead of a normal web page URL.

Getting Started

To connect your local machine to the remote machine, type

ftp machinename

where machinename is the full machine name of the remote machine, e.g., schoolname.cs.library.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.

When you enter your own loginname and password for the remote machine, it returns the prompt

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.

Common FTP Commands

? 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