How to use FTP

Subject: How to use FTP
From: Steve Owens <uso01 -at- EAGLE -dot- UNIDATA -dot- COM>
Date: Wed, 20 Apr 1994 10:50:41 +0700

> I have been unable to connect with pdq.coe.montana.edu any of the times
> that I have tried. For those of you unfamiliar with anonymous ftp, ftp
> to the above named site, login as ``anonymous'', use your email address as
> the password, cd to the correct directory, enter the ``bin'' command to
> transmit binary data, and ``get'' the file you want.

And for those of you completely unfamiliar with FTP, here's a
little file I wrote up some time back. Note that this was written for
a fairly homogenous university environment, where all of the PCs and
Macs were networked and pretty much all used the same software (NCSA
Telnet and FTP). Your own PC or Mac will probably use a different
package, and you may or may not have a mainframe (or need a mainframe)
to use as an intermediary.

This was originally written for the University of Pittsburgh,
and even though I've extensively rewritten it and it never did see the
light of day in its original form, I requested and received permission
to redistribute it, just to be on the safe side (maybe some of the
copyright mavens here can tell me just when it stops being the
original work-for-hire and when it starts being a new work, given that
it's all based on internal knowledge).

--------------------------------------------------------------------------------
-----
Copyright Steven J. Owens, 1994. Permission is granted to
redistribute this file on the technical writer's mailing list (TECHWR-L)
and on related technical writing or technical communications mailing lists,
as long as the contents (including this copyright notice) are kept intact.

Any disclaimer you can think of applies. I am not responsible
for any harm incurred in using these instructions, even if they result
in a total mass-to-energy conversion of your computer, destroying the
state you live in.

There are lots of useful guides to using FTP, Archie, etc, out
there on the net. Go a-roaming and dig up more information. Enjoy
yourself!


How to use FTP

Start by running FTP on your system:

|> $ ftp <return>
|> ftp>

Opening A Connection

FTP is similar on VMS and UNIX. On either service, enter the open
command, followed by the Internet address of the computer you're
connecting to via FTP, and press return.

|> ftp> open wuarchive.wustl.edu <return>

The address used above connects you to a popular archive site (see
above). You can use a shortcut, and enter the address after the ftp
command at the UNIX or VMS prompt.

|> $ ftp wuarchive.wustl.edu <return>

The exact message you see after connecting will vary depending upon
the particular site you're connecting to and the particular version of
Telnet you're using. The message should look something like:

|> Connected to wuarchive.wustl.edu.
|> 220 wuarchive.wustl.edu FTP server (Version 6.16 Wed Mar 4 17:05:16 CST 1992)

|> ready.

Logging In Anonymously

On UNIX services, the FTP program will prompt you for a log-in
name, usually something like this:

|> Name (wuarchive.wustl.edu:username):

Log in as anonymous. For the password, enter your e-mail adress
(i.e. yourusername -at- youraddress):

|> Name (wuarchive.wustl.edu:username): anonymous <return>
|> 331 Guest login ok, send your complete e-mail address as password.
|> Password: username -at- unix -dot- cis -dot- pitt -dot- edu <return>

On VMS, you will have to enter the USER command to log in. This
command is available on UNIX as well, but normally FTP automatically
issues it when connecting. Note that on VMS the FTP prompt shows the
address you are currently connected to:

|> WUARCHIVE.WUSTL.EDU> user <return>
|> Foreign username: anonymous <return>
|> <Guest login ok, send your complete e-mail address as password.
|> Password: username -at- vms -dot- cis -dot- pitt -dot- edu <return>


After you log in, a message from the FTP site will be displayed:

|> 230- This is an experimental FTP server. If your FTP client crashes or
|> 230- hangs shortly after login please try using a dash (-) as the first
|> 230- character of your password. This will turn off the informational
|> 230- messages that may be confusing your FTP client.
|> 230-
|> 230- This system may be used 24 hours a day, 7 days a week. The local
|> 230- time is Fri Apr 10 13:36:25 1992.
|> 230-
|> 230-Please read the file README
|> 230- it was last modified on Mon Mar 2 08:29:25 1992 - 39 days ago
|> 230-Please read the file README.NFS
|> 230- it was last modified on Thu Feb 20 13:15:32 1992 - 50 days ago
|> 230 Guest login ok, access restrictions apply.
|> ftp>

Basic FTP Commands

There are a few commands to learn with FTP:

Use... To...
ls or dir look at the FTP site (to see what's there)
cd move around the FTP site, (just as you have to
know how to move around your own computer)
get and put move the file you want (to or from the FTP site)


Type ls or dir to get a directory listing of the FTP site. ls
(familiar to UNIX users) or dir (familiar to VMS users) will display
all of the information on the files in the directory.

Several options are available with ls:

ls -c will display the directory in columnized format, making
it easier to view an entire directory at once, rather than searching a
list that's several screens long.

ls -F will display the directory with a / appended to
subdirectory names.

You can combine ls -c and ls -F, for example entering:

|> ftp> ls -cF <return>

to get a columnized listing of a directory, with a / appended to
subdirectories.

ls -l will display all of the information available on the files,
including permission bits, size, owner, time and date last modified,
and so forth. ls -l sometimes fails to work; the system thinks you're
trying to list a specific file, named -l, and cannot find it. ls -l
is slower than ls or ls -c, because it displays more information, and
the system requires more time to look for the information. To learn
more about ls, enter "man ls" at the UNIX $ prompt.

dir defaults to displaying the same information as ls -l.

In this example, ls is used to get a directory of the FTP site:

|> ftp> ls <return>
|> <Opening ASCII mode data connection for file list.
|> lost+found
|> mirrors
|> bin
|> decus
|> etc
|> info
|> network_info
|> packages
|> private
|> pub
|> systems
|> unix
|> graphics
|> usenet
|> techreports
|> mirrors2
|> vendorware
|> du.out
|> README.NFS
|> arrangement
|> README
|> files.lst
|> doc
|> ls-lR
|> .notar
|> files.lst.Z
|> ls-lR.Z
|> mirrors3
|> edu
|> <Transfer complete.>
|> ftp>

UNIX and DOS users will be familiar with directories. VMS
users may be familiar with the "directory" concept, although the
commands used are different. For Mac users, a folder is the same as a
directory. A directory is a list or catalog of files, some of which
can be other directories. You can figure out which files are
directories by using ls -F (see above). In the list above, the second
item, mirrors, is a useful directory, since it holds copies of many of
the files stored at a large archive site named simtel20.

Use the cd command to move around the FTP site. DOS and UNIX users
will be familiar with cd, short for "change directory." In FTP, cd
works much the same way. Using cd, you can enter another directory:

|> ftp> cd mirrors <return>
|> 250 CWD command successful.
|> ftp>

Each directory always has an invisible subdirectory named ".." (two
periods). This subdirectory normally doesn't show up when you use ls.
Instead of taking you to a lower directory, cd .. takes you "up" one
level, to the directory "above" your current directory. If you
entered cd .. now, you would move up from the mirrors directory, to
the directory shown above by ls.

|> ftp> cd .. <return>
|> 250 CWD command successful.
|> ftp>

You can copy files around using the get and put commands.
Think of the FTP site as a shelf, and the file as a book. You get a
copy of the book from the shelf, or put a copy of it on the shelf.
You get a copy of the file from an FTP site to where you are, or put a
copy of the file from where you are to an FTP site (put is most often
used to move your own files around). On VMS, FTP will often ask you
for a "local" name for the file, the name the file will be stored
under. You can simply press <return> and the file will be saved with
the same name it is stored under on the FTP site.


For the next couple of steps, I'll omit the example output
(sometimes the lists produced by the ls command are very long). Use
ls and cd to change to the mirrors directory, locate the macintosh
directory, change to the macintosh directory, locate the appl
(applications) directory, and change to the appl directory.

|> ftp> cd macintosh <return>
|> ftp> cd appl <return>

Now that you're in appl, the macintosh applications directory, you
can get some interesting files. However, unless you know exactly what
you want, and exactly what it's named, it may take some looking around
and guesswork. Many major FTP sites, like simtel20, and wuarchive,
keep a file in each directory named 00-index, or index.txt, or
00readme.txt, or something similar (the 00 is so that the file will be
listed first in the directory). These files have information about
what is stored in the directory. In this case the file is named
00readme.txt. The following command gets a copy of the file to your
VMS or UNIX directory.

|> ftp> get 00readme.txt <return>
|> 200 PORT command successful.
|> 150 Opening ASCII mode data connection for 00readme.txt (9151 bytes).
|> 226 Transfer complete.
|> local: 00readme.txt remote: 00readme.txt
|> 9344 bytes received in 0.98 seconds (9.3 Kbytes/s)
|> ftp>

The file was transferred to your local VMS or UNIX directory,
whichever directory you were in when you started FTP. You can change
your local directory with lcd (for local change directory). Note that
local in lcd means local to wherever FTP is being run. lcd changes
the directory on whichever system the FTP program is actually running
on. This can get confusing; for example, when you're connecting to a
system with Telnet and using FTP to put files back across to your
system, lcd changes the directory on the system you're connecting to.

Using Shell Commands In FTP

The way you will look at the 00readme.txt file depends upon
whether you're using VMS or UNIX. On UNIX, simply enter an ! at the
FTP prompt, followed by whatever command you would have used at the
UNIX prompt to read a file:

|> ftp> !more 00readme.txt<return>

On VMS you have to spawn a session to look at the 00readme.txt
file. Simply enter the command at the FTP prompt.

|> WUARCHIVE.WUSTL.EDU> spawn <return>
|> $

This starts up a log-in session. It looks and acts just like a
normal VMS log-in session. First, use type/page to look at the file.

|> $ type/page 00readme.txt <return>
|>
After you've read the file, enter logout and you'll return to your
FTP session. When you log out, you'll go right back to the FTP
prompt.

|> $ logout <return>
|> WUARCHIVE.WUSTL.EDU>
|>
ASCII and Binary Transfer Modes

Note that when you transferred the 00readme.txt file, it was in
ASCII mode.

|> 150 Opening ASCII mode data connection for 00readme.txt (9151 bytes).

ASCII is the default mode. This means the file was transferred in
an ASCII, or text, format. Other types of files, like applications or
files in compressed format, will not be transferred accurately in
ASCII format. The file you want to get this time is deskimaten.sit.
The sit extension on the filename means it's in a compressed format;
one we'll have to use Unstuffit, a Macintosh application, to
uncompress it before you can use it. This also means you have to use
a command to set the transfer mode to binary, before you get the file:

|> ftp> binary <return>

Now you can get the file.

|> ftp> get deskimaten.sit <return>
|> 200 PORT command successful.
|> 150 Opening binary mode data connection for deskimaten.sit (25472 bytes).
|> 226 Transfer complete.
|> local: deskimaten.sit remote: deskimaten.sit
|> 25666 bytes received in 1.1 seconds (23 Kbytes/s)

If you wanted to get some other ASCII format files you could set
the mode back to ASCII:

|> ftp> ascii <return>

Closing and Quitting From FTP

When you have the files you want, you close the connection , then
quit:

|> ftp> close <return>
|> 221 Goodbye.
|> ftp> quit <return>
|> $

FTP From Mainframe To Personal Computer

Presently, no personal computer FTP packages are supported at
the CIS computer labs. Instead, connect to the mainframe with Telnet,
then use FTP to connect back to the personal computer. You will put
files from the mainframe to your personal computer. The put command
works much like the get command. The first step after logging into
your timesharing account is to run FTP and open a session to your
personal computer (the XXX below represents the address of your
personal computer).

|> $ ftp XXX.XX.XXX.XXX <return>

If you know the numerical address for your PC, you can enter
it manually, as above. Most of the computers in the CIS labs use NCSA
Telnet to connect to the mainframe. You can have NCSA Telnet send the
numerical IP address for you. On DOS-based personal computers, this
is done by holding down the alt key and pressing the i key.

|> $ ftp <alt-i> <return>

On Macintosh pull down the Network menu and select the Send IP
Number option instead of pressing <alt-i>.

|> Connected to 130.49.16.121.
|> 220 Macintosh Resident FTP server, ready
|> Name (130.49.16.121:username): <return>
|> 230 User logged in

You can simply press <return>, since most personal computers are
not set up to require username and password. Before you actually put
the file, you should make sure it's going to the right directory or
folder on your personal computer. On a DOS-based PC, simply use the
cd command, much as you did above, to get to the right directory.
Remember, since FTP is connected from the timesharing account to the
PC, the "local" directory is on the account. cd will change the
directory on the PC, and lcd will change the directory on the account.

To set the Macintosh folder, pull the File menu down and select the
Set Transfer Directory option. Then set the directory just as you
would normally in a Macintosh application.

You also have to set the transfer mode. You're moving a binary
format file across, so enter binary at the FTP prompt, just as you did
before.

|> ftp> binary <return>

Once the directory and transfer mode are set, use the put command
to move the file from the account to the personal computer:

|> ftp> put deskimaten.sit <return>
|> 200 This space intentionally left blank < >
|> 150 Opening connection
|> 226 Transfer complete
|> local: deskimaten.sit remote: deskimaten.sit
|> 24212 bytes sent in 0.4 seconds (59 Kbytes/s)

Now you can close the connection.

|> ftp> close <return>
|> 221 Goodbye
|> ftp>

If you wish to connect to other FTP sites, you can do so by simply
opening another connection. Otherwise, just enter quit to exit FTP.

|> ftp> quit <return>
|> $

Before the application you've transferred from the FTP site
can be used, it has to be uncompressed. Numerous applications are
available for compressing and uncompressing files, for different kinds
of computers. There are far too many to be covered in this article.
This particular format (with the sit extension) can be uncompressed
with Unstuffit on the Macintosh. Unstuffit Deluxe is a freeware
package, available under the file name unstuffit151.bin at (you
guessed it) wuarchive.wustl.edu, in the mirrors/macintosh/appl
directory. Note the bin extension; you'll be able to use Unstuffit
immediately after transferring it to your Macintosh (remember to
enable MacBinary). See the Unstuffit documentation for further
information.



Some Popular FTP Sites

All across the Internet, there are host computers that allow
anonymous FTP, which means you can connect, log in as anonymous and
get files. These hosts are called FTP sites, archive sites or FTP
archives.

There are several popular FTP sites: wuarchive.wustl.edu
"mirrors" (maintains copies of) a very large, popular archive site
named Simtel20, with lots of interesting software; prep.ai.mit.edu is
the main site for GNU software; tut.cis.ohio-state.edu is another site
for GNU software.

DOS-based PC software is available at a wide variety of sites,
including Simtel20. Macintosh software seems to be harder to find,
but large selections are available at sumex-ai.stanford.edu,
mac.archive.umich.edu, rascal.ics.utexas.edu (for Gatekeeper sources)
and ftp.apple.com (for System 7 software, printer drivers, source code
samples, and the latest versions of Resedit and MacsBug).

Simtel20 is a site you will inevitably hear about once you
start to explore the Internet. Simtel20 is a massive and popular
archive site full of software and files of all sorts, maintained at a
U.S. military base on surplus hardware. It's also constantly under a
heavy load, so you should avoid using it. Instead, use one of the
many mirror sites, which carry duplicates of the contents of Simtel20
(wuarchive.wustl.edu is one such mirror site). Once you connect, cd
into the mirrors directory and proceed from there as if you were on
Simtel20.

--------------------------------------------------------------------------------
-----


Previous by Author: Need Island Write info
Next by Author: That's all I can stand...
Previous by Thread: Need Island Write info
Next by Thread: That's all I can stand...


What this post helpful? Share it with friends and colleagues:


Sponsored Ads