cd

Zen and the Art of the Internet

Go to the Table of Contents. Visit Gifcom

 cd
 
At the beginning of an FTP session, the user is in a ``top-level''
directory.  Most things are in directories below it (e.g. /pub).  To
change the current directory, one uses the cd command.  To change to
the directory pub, for example, one would type
 
ftp> cd pub
 
which would elicit the response
 
250 CWD command successful.
 
Meaning the ``Change Working Directory'' command (cd) worked
properly.  Moving ``up'' a directory is more system-specific---in Unix
use the command cd .., and in VMS, cd [-].
 
 get and put
 
The actual transfer is performed with the get and put
commands.  To get a file from the remote computer to the local
system, the command takes the form:
 
ftp> get filename
 
where filename is the file on the remote system.  Again using
ftp.uu.net as an example, the file newthisweek.Z can be
retrieved with
 
ftp> get newthisweek.Z
200 PORT command successful.
150 Opening ASCII mode data connection for newthisweek.Z (42390 bytes).
226 Transfer complete.
local: newthisweek.Z remote: newthisweek.Z
42553 bytes received in 6.9 seconds (6 Kbytes/s)
ftp>
 
The section below on using binary mode instead of ASCII will describe
why this particular choice will result in a corrupt and subsequently
unusable file.
 
If, for some reason, you want to save a file under a different name
(e.g. your system can only have 14-character filenames, or can only
have one dot in the name), you can specify what the local filename
should be by providing get with an additional argument
 
ftp> get newthisweek.Z uunet-new
 
which will place the contents of the file newthisweek.Z in
uunet-new on the local system.
 
The transfer works the other way, too.  The put command will
transfer a file from the local system to the remote system.  If the
permissions are set up for an FTP session to write to a remote
directory, a file can be sent with
 
ftp> put filename
 
As with get, put will take a third argument, letting you
specify a different name for the file on the remote system.