Roadmap96: MAP14 - FTP (Part Two) | WebReference

Roadmap96: MAP14 - FTP (Part Two)

Roadmap96

RM 01 02 03 04 05 06 07 08 09 10
11 12 13 14 15 16 17 -B 18 19 20
21 22 23 24 25 XT XT 26 XT 27   

MAP14: FTP (PART TWO)

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

In MAP13 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 usually 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; and
  9. Quit.

Let's pick up where we left off in our last lesson. I have accessed the InterNIC's FTP site (rs.internic.net), have told the site that I am "anonymous", and have given the site my full Internet e-mail address as my password.

Now that I am in, I am going to look around and see what the InterNIC's 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:

     200 PORT command successful.
     150 Opening ASCII mode data connection for /bin/ls.
     226 Transfer complete.
     total 52
     drwxr-xr-x  8 507      1             512 Jun  6 04:05 NIC-support
     drwxr-xr-x 16 60       1             512 Jun 12 23:34 archives
     drwxrwxr-x  2 root     10            512 Jun 17 17:38 billing
     drwxr-xr-x  2 root     1             512 Mar 20 23:44 bin
     drwxr-xr-x  2 root     1             512 Apr  5 10:34 dev
     drwxr-xr-x  2 60       1             512 Jun 17 17:34 domain
     drwxr-xr-x  2 root     1             512 Mar 20 23:44 etc
     drwxr-xr-x  2 60       1             512 Mar 20 23:45 home
     drwxr-xr-x  4 root     1             512 Jun 17 17:49 internic
     -rw-rw-r--  1 60       1           29843 Jan  9 02:54 ls-ltR
     ... %< snip snip snip %< ...

This is a listing of all of the stuff in the current directory (actually, this is a listing of SOME of the stuff in this directory; for the sake of clarity, I used my Internet scissors (%<) to edit this directory to a reasonable size). Let's take a look at the first entry and see if we can figure out what all of this means:

     drwxr-xr-x  8 507      1             512 Jun  6 04:05 NIC-support

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 in a particular room.

Getting back to our example,

     drwxr-xr-x  8 507      1             512 Jun  6 04:05 NIC-support

the " drwxr-xr-x" tells us that this entry is a subdirectory (the "rwxr-xr-x" part is just some security stuff). The "512" tells us the size of the subdirectory in bytes. The "Jun 6 04:05" tells us the date and time that this subdirectory was last updated. The last part -- the "NIC-support" -- tells us the name of the subdirectory.

Let's look at one more example:

     -rw-rw-r--  1 60       1           29843 Jan  9 02:54 ls-ltR

There is a "-" instead of a "d", so this is a file. The "29843" tells us that the size of this file is 29,843 bytes (just over 29 K), the file was last updated at 02:54 on the morning of January 9, and the name of this file is "ls-ltR".

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

     drwxr-xr-x  8 507      1             512 Jun  6 04:05 NIC-support
     drwxr-xr-x 16 60       1             512 Jun 12 23:34 archives
     drwxrwxr-x  2 root     10            512 Jun 17 17:38 billing
     drwxr-xr-x  2 root     1             512 Mar 20 23:44 bin
     drwxr-xr-x  2 root     1             512 Apr  5 10:34 dev
     drwxr-xr-x  2 60       1             512 Jun 17 17:34 domain
     drwxr-xr-x  2 root     1             512 Mar 20 23:44 etc
     drwxr-xr-x  2 60       1             512 Mar 20 23:45 home
     drwxr-xr-x  4 root     1             512 Jun 17 17:49 internic
     -rw-rw-r--  1 60       1           29843 Jan  9 02:54 ls-ltR
     ... %< snip snip snip %< ...

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

cd <directory>

and replace <directory> with the name of the directory or subdirectory that you want to access. Since we're visiting the InterNIC, let's drop in and visit the "internic" subdirectory. To access the internic subdirectory, I type

cd INTERNIC

and the following appears on my screen:

     550 INTERNIC: 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 INTERNIC" command did not work because there is no "INTERNIC" directory ... but there *IS* an "internic" directory. :)

Let's try this again. I type

cd internic

and the following appears on my screen:

     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:

     200 PORT command successful.
     150 Opening ASCII mode data connection for /bin/ls.
     226 Transfer complete.
     total 4
     -rw-r--r--  1 root     1             210 Dec 19  1995 README
     drwxr-xr-x  2 root     1             512 May 20 21:46 faq
     drwxr-xr-x  2 root     1             512 Mar 20 23:54 pgp
     lrwxrwxrwx  1 root     1              18 Mar 20 23:54 policy ... 

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, 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 Internet 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 file extension or filetype. You cannot have a file whose name is just README ... it has to be README.<type> (e.g. README.DOC, README.TXT, etc).

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

get <filename> <name I want it saved as>

command, replacing <filename> with README, and replacing <name I want it saved as> with the name that I want the file to be saved as on my Internet Service Provider's computer.

So, I type

get README README.DOC

and the following appears on my screen:

     200 PORT command successful.
     210 bytes received.
     150 Opening ASCII mode data connection for README (210 bytes).
     226 Transfer complete.

YIPPEE! It worked!! Let's quit FTP and see what we did.

To quit FTP, you need to use either the "bye" or "quit" command. 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 Internet Service Provider's system!

Depending on your system, it is either easy or hard to access the files that you 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 file contains the following information:

     This is the InterNIC documentation series that consists of two
     directories:
     1) policy - current InterNIC-specific registration policies.
     2) faq - documents dealing with InterNIC frequently asked 
        questions.

Not a whole bunch of information, but at least it was short. Actually, I am sure that you are probably wondering just what the InterNIC is, so this information is pretty useful after all. Since we are looking for the answers to our questions about the InterNIC, and since the word "faq" stands for "Frequently Asked Questions", I'm willing to bet we can find the answers to our questions about the InterNIC in the "faq" subdirectory.

So, thanks to what we learned from the README file, we now know that the file that we are looking for is in "internic" directory and in the "faq" subdirectory.

In FTP notation, I can write this as

/internic/faq

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

By the way, if I wanted to write the *complete* Internet address for the article's subdirectory, I would write

ftp://rs.internic.net/internic/faq

This sort of address is called a Uniform Resource Locator (URL). We'll talk a lot about URLs in the last week of the workshop, but here is a quick way to read URLs. The first part of a URL (which, in this case, is "ftp://") just tells you what Internet tool you need to use to access that particular Internet resource (since the first part says "ftp://", want to take a guess what tool we are going to be using?). The second part of the URL (in this case "rs.internic.net") tells you the address of the Internet resource that you are connecting to, and the last part of the URL (in this case "/internic/faq") tells you the resource's directories and subdirectories.

As I said earlier, we'll talk a lot about URLs during the last week of the workshop (and we will especially talk about how to access URLs that start with "http://"). For now, just remember how to translate a URL like

ftp://rs.internic.net/internic/faq

into something that you can actually use. :)

Anyway, let's go back to the InterNIC and find some answers to our frequently asked questions! I type

ftp rs.internic.net

and the following appears on my screen:

     220-*****Welcome to the InterNIC Registration Host  *****
         *****Login with username "anonymous"
         *****You may change directories to the following:
           policy            - Registration Policies
           templates         - Registration Templates
           netinfo           - NIC Information Files
           domain            - Root Domain Zone Files
     220 And more!

I don't see a prompt asking me for my userid, so I type

USER

and the following appears on my screen

Username:

Since I do not have an account on the InterNIC server, I type

anonymous

and the following appears on my screen:

     331 Guest login ok, send your email address as password.
     Password:

I type my full Internet e-mail address -- crispen@campus.mci.net -- as my password, and I'm logged in! I know that I want to get into the "internic" directory, and then into the "faq" subdirectory. I could type "cd internic" and then "cd faq" to get into the subdirectory that I want, but it would be easier to just jump into the "faq" directory with one command.

I can make such a jump using the "/internic/faq" notation introduced a few minutes ago. If I type

cd /internic/faq

I jump straight into the "faq" directory, and the following appears on my screen:

     250 CWD command successful.

Since I have no idea what is in the "faq" subdirectory that I just entered, I type

dir

and the following appears on my screen:

     200 PORT command successful.
     150 Opening ASCII mode data connection for /bin/ls.
     226 Transfer complete.
     total 2
     -rw-r--r--  1 root     1         1907 Dec 19 22:09 new ...
     -rw-r--r--  1 root     1         1642 May 20 21:30 roadmap.faq

There are two files in this directory (you can tell because of the "-" in the first column). Hmmm ... now which of these two files do you think we are going to get?

The new domain registration faq is pretty technical, but the "roadmap.faq" file is a file written for this workshop that explains what the InterNIC is. Since the file I want is "roadmap.faq", I type

get roadmap.faq

and the following appears on my screen:

     200 PORT command successful
     150 Opening ASCII mode data connection for roadmap.faq
         (1642 bytes).

After a few seconds, the following is added to my screen:

     226 Transfer complete.  1642 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 "roadmap.faq" is now sitting in my account on my local Internet Service Provider's machine!!


Start Lesson Fifteen | Go to the Roadmap96 Syllabus | Go to the Roadmap96 Homepage


Originally written by Patrick Douglas Crispen