RoadMap 14

MAP14: FTP (PART TWO)


"Technology ... the knack of so arranging the world that we need not experience it."
-- Max Frisch, Homo Faber

Yesterday I told you that the basic steps in an FTP session are:

  1. Start-up your FTP client
  2. Give your FTP client an address to connect to (and, just like TELNET, step one and two can be combined into one easy step).
  3. Identify yourself to the remote site
  4. Give the remote site your password
  5. Look around the directory for files
  6. Change Directories
  7. Set the transfer mode (optional)
  8. Get the file(s) you want
  9. Quit

I've accessed SURAnet's FTP site (ftp.sura.net), told the site that I am "anonymous", and given the site my full Internet address as my password.

Now that I'm in, I'm going to look around and see what the SURAnet FTP site has to offer.

(BTW, you can see a list of all of the acceptable commands for your FTP client by typing "help")

On most FTP clients, the command to list the contents of the current directory on the remote machine is just

dir
My FTP client accepts and uses the "dir" command, so I type
dir
and the following appears on my screen:

>>>PORT 130,160,4,100,212,230
200 PORT command successful
>>>LIST
150 Opening ASCII mode data connection for /bin/ls. total 728

   drwxrwx--x   3 0        0              512 Aug  5 01:55 bin
   drwxr-xr-x   2 0        1              512 May 10 12:47 etc
   drwxrwxrwx   6 0        10             512 Oct 21 11:37 incoming
   drwxr-xr-x   2 0        0             8192 Feb 15  1992 lost+found
   -rw-r--r--   1 0        1           350142 Oct 25 00:00 ls-lR
   drwxrwxr-r  24 0        100            512 May  3 13:25 pub

This is a listing of all of the stuff in the current directory. Let's take a look at the first entry and see if we can figure out what all of this means:

drwxrwx--x 3 0 0 512 Aug 5 01:55 bin
If the line begins with a "-" instead of a "d", it is a file. The letter "d" at the beginning of this example tells me that this is not a file -- it is a subdirectory.

What does THAT mean? Well, pretend that the FTP site is simply a big house. You walk into the house through the front door, and you find yourself standing in an entry hall. The entry hall may have some neat stuff in it, but it also has doors leading to other rooms throughout the house.

The subdirectories -- the "d"s -- are just doors to other "rooms" at the FTP site, and the files -- the "-"s -- are the neat stuff that you can get while you are at the site. Getting back to our example,

drwxrwx--x 3 0 0 512 Aug 5 01:55 bin
the "drwxrwx--x" tells us that this entry is a subdirectory (the "rwxrwx--x" part is just some security stuff). The "512" tells us the size of the subdirectory in bytes. The "Aug 5 01:55" tells us the date and time that this subdirectory was last updated. The last part -- the "bin" -- tells us the name of the subdirectory.

Let's look at one more example:

-rw-r--r-- 1 0 1 350142 Oct 25 00:00 ls-lR
There is a "-" instead of a "d", so this is a file. The "350142" tells us that the size of this file is 350,142 bytes, the file was last updated at midnight on October 25, and the name of this file is "ls-lR".

Let's get back to the main SURAnet directory contents:

   drwxrwx--x   3 0        0              512 Aug  5 01:55 bin
   drwxr-xr-x   2 0        1              512 May 10 12:47 etc
   drwxrwxrwx   6 0        10             512 Oct 21 11:37 incoming
   drwxr-xr-x   2 0        0             8192 Feb 15  1992 lost+found
   -rw-r--r--   1 0        1           350142 Oct 25 00:00 ls-lR
   drwxrwxr-r  24 0        100            512 May  3 13:25 pub

I want to change this main directory and get into a subdirectory. To change directories on most FTP clients, you use the command

cd <directory>
and replace <directory> with the name of the directory that you want to access.

Since I am interested in public information, I'm going to get into "pub" directory ("pub" is the standard FTP abbreviation for "public"). I type

cd PUB
and the following appears on my screen:
>>>CWD PUB
550 PUB: No such file or directory.
Uhhh ... what happened?

One of the unfortunate shortcomings of FTP is that, for most of you, FTP is case sensitive. My "cd PUB" command did not work because there is no "PUB" directory ... but there IS a "pub" directory :)

Let's try it again. I type

cd pub
and the following appears on my screen:

>>>CWD pub
250 CWD command successful.

Cool! It worked!

Now I need to see the contents of this new directory that I just entered. Do you remember what FTP command I should use? (Hint: it is "dir")

I type "dir", and the following appears on my screen:

>>>PORT 130,160,4,100,215,140
200 PORT command successful.
>>>LIST
150 Opening ASCII mode data connection for /bin/ls. Total 56
   -rw-rw-r--   1 1023     100           4052 Apr 22  1994 README
   drwxrwsr-x   2 1023     100            512 Aug  6  1993 SURAnet
   drwxrwxr-x   6 1020     120            512 Mar  3  1992 archie
   drwxrwxr-x   2 1034     120            512 Feb 15  1992 articles
   drwxrwxr-x   2 1007     110            512 Jun 22 15:40 books

... <stuff deleted by me>

Whoa! That first file -- README -- looks pretty important. I bet it contains some important information that will make my life a whole bunch easier (Good rule of thumb: if you see a file that contains the words README or INDEX, it is an important file).

I need to get this README file.

To get a file using FTP, you use the

get filename
command, replacing <filename> with the name of the file that you want to get. The get command retrieves the file from the remote site and stores the file on your service provider's system.

Since I want to get the README file, I type

get README
(making sure to use the correct case), and the following appears on my screen:
Invalid local filename; use 'name.type.mode' or 'name.type'
Now what?!?

This is a problem that some of you may have when you try to get "one word" files. Some local Internet service providers require files stored on their machines to have some sort of extension or type. Your can't have a file whose name is just README ... it has to be README.<type> (i.e. README.DOC, README.TXT, etc).

Since the "get README" command did not work, I'm going to have to use the

get <filename> <name I want it saved as>
command, replacing <remote file name> with README, and replacing <name I want it saved as> with the name that I want the file to be saved as on my service provider's computer.

So, I type

get README README.DOC

and the following appears on my screen:

>>>PORT 130,160,4,100,218,90
200 PORT command successful.
>>>RETR README
150 Opening ASCII mode data connection for README (4502 bytes).
After a few additional seconds, the following is added to my screen:
226 Transfer complete.
4637 bytes transferred. Transfer rate 6.14 Kbytes/sec.
YIPEE! It worked!! Let's quit FTP and see what we did.

To quit ftp, you need to use either the "bye" or "quit" commands.

On my client, the command is "quit", so I type

quit
and the following appears on my screen:
221 Goodbye.
Ready; T=0.54/0.96 01:45:53

Okay .. I got the file. But where is it? It is sitting on my account on my service provider's system!

Depending on your system, it is either easy or hard to get into the files that get from FTP (in Unix, type "ls"; in VM, type "fl"). Your local Internet service provider can tell you a little more about how to access, read, and print these files.

Looking at this new file that I just got from FTP, I discover that the contents of the README file are a brief explanation of what is in every subdirectory off of the pub directory (cool!):

   The following items are available anonymous ftp from
   ftp.sura.net:

   Directories found under pub:

   archie/          Information on the archie service as well as client
                    software to use archie.

   articles/        Text versions of articles in the SURAnet newsletter.

   books/           Subdirectory containing information on ordering
                    discounted books through SURAnet.

   databases/       The databases in raw format that are also offered
                    through our WAIS server.

   dns/             Software and documentation to help setup the Domain
                    Name Server software on Unix machines (BIND)

   fdic/            The Federal Deposit Insurance Corporation's ftp
                    archive.

... <<stuff deleted by me>>

NEAT! :)

I want to go back and get one of the articles in the SURAnet newsletter. Thanks to what I learned from the README file, I now know that the files that I am looking for are in "pub" directory and in the "articles" subdirectory.

In FTP notation, I can write this as

/pub/articles

This means the same thing as saying "in the pub directory, in the articles subdirectory" and, as you will soon see, this notation will eventually even save me a few steps.

Let's go back to SURAnet and get some newsletter articles!

I type

ftp ftp.sura.net
and the following appears on my screen:
Connecting to ftp.sura.net 128.167.254.179, port 21 220 nic.sura.net FTP server (Version wu-2.4(1) Fri May 20 10:20:58 EDT 1994) ready.
USER (identify yourself to the host):
Since I do not have an account on the SURAnet machine, I type
anonymous
and the following appears on my screen:
>>>USER anonymous
331 Guest login ok, send your complete e-mail address as password. Password:
I type my full Internet address -- pcrispe1@ua1vm.ua.edu -- as my password, and the following appears on my screen:
>>>PASS ********
230- SURAnet ftp server running wuarchive experimental ftpd 230-
230-Welcome to the SURAnet ftp server. If you have any problems with 230-the server please mail the to systems@sura.net. If you do have problems, 230-please try using a dash (-) as the first character of your password 230- -- this will turn off the continuation messages that may be confusing 230-your ftp client.
...
230 Guest login ok, access restrictions apply. Command:
I know that I want to get into the pub directory, and then into the articles subdirectory. I could type "cd pub" and then "cd articles" to get into the subdirectory that I want, but it would be easier to just jump into the "articles" directory with one command.

I can make such a jump using the /pub/articles notation introduced a few minutes ago. If I type

cd /pub/articles
I jump straight into the "articles" directory, and the following appears on my screen:
>>>CWD /pub/articles
250 CWD command successful.
Command:
Since I have no idea what is in the "articles" subdirectory that I just entered, I type
dir
and the following appears on my screen:
>>>PORT 130,160,4,100,222,127
200 PORT command successful
>>>LIST
150 Opening ASCII mode data connection for /bin/ls. Total 382
   -rw-rw-r--   1 0      120          1510 Jan  3  1992 editors.box.text
   -rw-rw-r--   1 0      120         46167 Jan  3  1992 fall91.issue
   -rw-rw-r--   1 0      120         52864 Jan  3  1992 spring91.issue
   -rw-rw-r--   1 0      120          1515 Jan  3  1992 sub.form.txt
   -rw-rw-r--   1 0      120         36418 Jan  3  1992 summer91.issue
   -rw-rw-r--   1 0      120         53606 Jan  3  1992 winter90.issue
226 Transfer complete
COOL! These files already have extensions (winter90.issue, etc.), so getting them is going to be a breeze!

Let's get the Fall '91 issue. Since I want the file "fall91.issue", I type

get fall91.issue
and the following appears on my screen:
>>>PORT 130,160,4,100,224,34
200 PORT command successful
>>>RETR fall91.issue
150 Opening ASCII mode data connection for fall91.issue (46167 bytes).
After a few seconds, the following is added to my screen:
226 Transfer complete.
47151 bytes transferred. Transfer rate 16.58 Kbytes/sec.
IT WORKED!!! YAY!!! :)

I then quit FTP by typing either "bye" or "quit", and I am done! The file "fall91.issue" is now sitting in my account on my local Internet service provider's machine!!

TOMORROW:


To go to the next lesson, click on the arrow or you can go back to the Index .


ROADMAP: Copyright Patrick Crispen 1994, 1995. All rights reserved.

To unsubscribe from any Roadmap workshop, please send an e-mail letter to LISTSERV@UA1VM.UA.EDU which says UNSUB * in the body of your letter.

The address that sent this e-mail letter (CRISPEN@UA1VM.UA.EDU) is actually the address of an automated error processor. Please DO NOT reply to this e-mail letter as the error processor will consider your reply to be an error message and will delete your letter unread. To contact Patrick Crispen, please use my PCRISPE1@UA1VM.UA.EDU address.

(\__/)  .~    ~. )) 
   /O O `./      .'               PATRICK DOUGLAS CRISPEN
  {O__,   \    {                   PCRISPE1@UA1VM.UA.EDU
    / .  . )    \                THE UNIVERSITY OF ALABAMA
    |-| '-' \    } ))
   .(   _(   )_.'
  '---.~_ _ _&                       Warning: squirrels.

armd@physics.wm.edu