Sie sind auf Seite 1von 5

Hostname: naic.nasa.

gov
Directory path: files/general_info/
Filename: using-ftp.txt
Updated: July 12, 1993 (mks)

USING THE FILE TRANSFER PROTOCOL (FTP)


======================================

WHAT IS "FTP"?
--------------
FTP (File Transfer Protocol) is the part of the TCP/IP protocol suite
that helps users move files between systems easily, and can be
tailored to match the specific types of files involved. If your
computer uses TCP/IP, you can use FTP. MultiNet users can do
file transfers too. While some systems look
different, FTP's functions are standardized, which means you can perform FTP
transfers between TCP/IP hosts anywhere in the world. Because of this,
many sites have set up software libraries that are available to all
network users via anonymous FTP (explained later).

WHAT CAN FTP DO FOR ME?


-----------------------
Since FTP performs an actual login from your host to a remote host,
you can browse the remote host's files and directories just as if you
had used TELNET or SET HOST. However, FTP also allows for a special
type of login, called anonymous FTP. In this case, users do not need
accounts of their own on a system; instead, they can log into a
communal account with the userid "anonymous." (In such cases, proper
"nettiquette" is to provide one's electronic mail address as a
"password.") Hundreds of sites worldwide support Anonymous FTP
accounts to distribute information, graphics, and free or low cost
software. This handout will help you use both "standard" and
"anonymous" FTP; for more information on available anonymous FTP
sites, please contact the NAIC (which is itself an anonymous FTP
site!) at 415-604-0600 or naic@nasa.gov or EAST::"naic@nasa.gov".

HOW CAN I USE FTP?


------------------
To begin a session, you type the FTP command and either the name
of the host to which you wish to connect, or its IP address.
(Note that many hosts are case sensitve; for that reason, commands
are shown here in lowercase. Your host may prefer the initial
"FTP" command to be in uppercase.)
For example, to open an FTP connection to the host naic.nasa.gov,
you would type either
ftp naic.nasa.gov
or
ftp 128.102.128.6
Once your connection is established, you will be prompted to login.
If you are connecting to a host on which you have an account, provide
your userid, either by simply typing it on a Unix system or by typing
"USER" first on a VMS system. When prompted for your password,
provide it. If you are connecting to an anonymous FTP host, when
prompted to log in, use "anonymous" as your user name. When prompted
for a password, type your electronic mail address or the word "guest."
Once you have logged in, the system prompt changes to either ftp> or
the name of the remote host; in either case, you will enter all
commands at this prompt. Note that online help for FTP commands can
be obtained by typing help while the FTP prompt is on the screen.

HOW DO I SEE FILES ON THE REMOTE SYSTEM?


----------------------------------------
To see what files and directories are available on the remote system,
you can use either the DIR or ls commands (some systems only
understand "ls"; some systems will only understand "dir" in lowercase).
DIR will get you something like this:
drwxr-xr-x 2 0 10 512 Apr 13 1989 bin
drwxr-xr-x 2 14 10 512 Apr 13 1989 etc
-rw-r--r-- 1 0 0 28503 Sep 10 06:36 ls-lRt
drwxr-xr-x 14 14 10 1024 Feb 21 14:08 pub
A "d" in the first column indicates a directory; a dash in the first
column indicates a file. (When using "ls", you won't get this
information, but directory names are often followed by a "/".) The
series of letters and dashes show file protection (Read, Write, and
eXecute); this is shown rwxrwxrwx for owner, group, and world access;
you will be able to look at any files/directories with an "r" in the
last triplet.

HOW DO I MOVE AROUND ON THE REMOTE SYSTEM?


------------------------------------------
This depends a bit on what type of machine the remote host is. For
the vast majority of systems that support FTP, you simply type "cd"
and the directory name to move "down" into the named directory, and
"cd .." (that's two periods) to move back "up" one level in the directory
hierarchy. You can also immediately zoom up to the FTP login level
directory (where you started after connecting to the remote host) by
typing cd /
Navigation commands differ on VMS systems. You must type
CD [.directory] to move down and CD [..] to move up (include the
brackets). Otherwise, the directory navigation commands are pretty
much universal.

WHAT KIND OF FILE TRANSFERS CAN I DO WITH FTP?


----------------------------------------------
FTP has several commands you may need to use before initiating the
actual transfer, depending on what type of files are involved. There
are two basic commands for this: BINARY (or IMAGE) and ASCII.
The default mode for FTP transfers is ASCII. This works fine for text
files, but will ruin executables and image files. To successfully
transfer binaries, you must type the command "binary" (or "bin" or
"image") at the prompt before initiating the transfer. Similarly,
text-only files will become "garbage" if they are transferred in
binary mode. If you want to transfer text after transfering a binary,
make sure you type "ASCII" first! (See the table at the end of
this document for a listing of which file types require which FTP
transfer mode.)

CAN I FOLLOW THE PROGRESS OF AN FTP TRANSFER?


---------------------------------------------
Yes, sort of -- type the command "hash" before initiating a transfer,
and the system will print a series of pound signs (#) on-screen as the
transfer runs.

HOW DO I COPY A FILE FROM THE REMOTE HOST ONTO MY OWN?


------------------------------------------------------
To receive, or get, a file from the remote host, you should use the GET
command; the proper syntax is "get remotefilename targetfilename"
The target file name refers to the name you want the file to have
on your local computer, the computer to which the file is moving.
The target file name is optional; the system will default to the
original file name if you don't indicate a target file name. This is
just a handy way of transferring and renaming the file in one step.
Note: UNIX systems can use multiple periods in a filename (e.g.
"blah.tar.Z"), but VMS cannot! Make sure the remote file name is
compatible with your host's operating system! The example below
copies the file appl.sit.hqx from the remote host, renaming it
appl.hqx in transit.
Example: ftp> get appl.sit.hqx appl.hqx
Beginning ASCII transfer...
Transfer complete.
14 bytes transmitted in 1 second. (14 bytes/s)

CAN I LOOK AT A FILE WITHOUT TRANSFERRING IT FIRST?


---------------------------------------------------
FTP allows you to read the contents of text files "on the fly" without
actually placing a copy of the file on your system by making your
screen the destination. Although the commands for UNIX and VMS
systems are similar, there are a few differences.
On a VMS system, simply type GET filename TT: and the contents of that
text file will scroll across your screen. NOTE: Be ready to hit
Control-S or "Hold Screen"; the entire file will scroll by without
stopping for page breaks!
On a UNIX system, simply type get filename /dev/tty and the contents
of that text file will scroll across your screen. If you want the
display to stop scrolling each time the screen fills, use the command
get filename |more (some versions of UNIX will use |pg instead); you
will then be able to read through the text one screen at a time.
CAN I MOVE A FILE ONTO THE REMOTE HOST?
---------------------------------------
The PUT command works just like the GET command (but without the TT:
trick), complete with the dangers of different operating systems
having different file naming conventions. Note that the majority of
anonymous FTP sites will not allow you to put files onto their disks
without prior permission (and then usually only into specific
directories). Contact the adminstrator of each specific anonymous
FTP archive for information on his or her site's policies.

HEY -- HOW DO I GET OUTTA HERE?!?


---------------------------------
To exit from FTP (and log off the remote system), just enter the
command "bye" or "exit" or "quit" at the prompt (different systems may
react to only one or the other of these commands, but the results
will be the same). If you end up looking at the "ftp>" prompt, simply
enter the same command a second time to return to your normal system
prompt.

If you have any questions, please contact the NAIC for more information:
NASA Network Applications and Information Center
Ames Research Center
M/S 233-18
Moffett Field, CA 93025-1000
phone: 415-604-0600 fax: 415-604-7300
naic@nasa.gov EAST::"naic@nasa.gov"

HOW DO I KNOW WHICH TRANSFER MODE (ASCII OR BINARY) TO USE?


-----------------------------------------------------------
The following table describes the most common file types (listed by
filename extension) and the FTP mode (ASCII or BINARY) you need for a
successful transfer.
file type USUALLY means... transfer mode:
----------- --------------------------------------- ----------------------
.arc DOS compression format BINARY
.bak usually a binary backup (depends on system!)
.bck backup (archived) format BINARY
binscii Apple II archive format BINARY
.com VMS command file in DCL ASCII
.com executable command file in DOS BINARY
.cpt PackIt archive format (Mac) BINARY
.dat VMS data files BINARY
.doc usually ASCII text ASCII
.dvi special TeX text output format BINARY
.eps Encapsulated PostScript BINARY
.exe executable file BINARY
.gif GIF graphics format BINARY
.h "include" file for 3GL or 4GL compiler ASCII
.hlb VMS help libraries BINARY
.hlp VMS help files ASCII
.hqx BinHex (ASCII text) format (Macintosh) ASCII
.jpg JPEG graphics format BINARY
.lbr very old LU archive format (CP/M) BINARY
.lis usually text or program listing ASCII
.lzh Lempel-Ziv compression format BINARY
.lzw LHWarp archive (Amiga) BINARY
nupack Apple II archive format BINARY
.o, .obj compiled (but unlinked) programs BINARY
.pak "packed" archive format (DOS, OS/2) BINARY
.pcx PCX graphics format BINARY
.pict PICT graphics format BINARY
.pit "packed" archive format (Mac) BINARY
.pnt MacPaint format BINARY
.ps postscript format BINARY
._Q_ "Squeeze" (CP/M) archive BINARY
.riff RIFF graphics format BINARY
.rno DEC Standard Runoff format ASCII
.sea self-extracting archive BINARY
.shar, .sh UNIX SHell ARchive BINARY
.sit StuffIt archive format (Mac) BINARY
.tar UNIX Tape ARchive format BINARY
.tex TeX formatted text files ASCII
.text ASCII text ASCII
.tga Targa graphics format BINARY
.tiff TIFF graphics format BINARY
.txt ASCII text ASCII
.uu, .uue UUencoded archive (UNIX) ASCII
.wrp Warp archive format (Amiga) BINARY
.xx, .xxe xxencode format archive (UNIX) ASCII
.Z UNIX Compress format BINARY
.zip DOS compression format BINARY
.zoo ZOO format archive BINARY

Das könnte Ihnen auch gefallen