|
"The quickest way to a man's heart is through his chest, with an axe"
-- Unknown
|
The best way to understand what is going on is to look at a sample
FTP session. MIT maintains an anonymous FTP server
(rtfm.mit.edu), and in this particular
server, there is whole bunch of up-to-date FAQs (Frequently Asked Questions) on
almost everything you can imagine under
"/pub/usenet/news.answers"
subdirectory, so I'm going to FTP to it.
Starting an FTP session is pretty easy. For most of you, all you
have to do to start-up your FTP client is type
-
bash:[sparky] ~>ftp
on you system's command prompt (or, if you are in a Windows or Mac
environment, double-click on the FTP icon). Like
Telnet, however,
there is a way to combine these two steps into
one, easy step. For most of you, to access your FTP client and give
your client an address to hook up to, all you would have to do it
type the command
-
ftp <site address>
and replace <site address> with the address of the FTP site that you
want your client software to access.
In our example, MIT's FTP address is rtfm.mit.edu,
so I would type
-
bash:[sparky] ~>ftp rtfm.mit.edu
to start an FTP session. Once I hit the enter key, the following appears
on my screen:
-
bash:[sparky] ~> ftp rtfm.mit.edu
Connected to PENGUIN-LUST.MIT.EDU.
220 rtfm ftpd (wu-2.4(67) with built-in ls); bugs to ftp-bugs@rtfm.mit.edu
Name (rtfm.mit.edu:yoon):
The second line tells me that my system is connecting to
rtfm.mit.edu,
the third line is some automatic information from rtfm.mit.edu, and the
bottom line is asking me to log in. If I had an account on the rtfm.mit.edu
system, I would enter my rtfm.mit.edu's user ID. But, since I don't have an
account on this system, I have to find another way to access the system. ;)
This is where the "anonymous" FTP I
mentioned earlier comes in. The other way to access some FTP sites -- at
least those FTP sites that allow outside access -- is to use the userid
"anonymous". By using the name "anonymous", you are telling that FTP site that you
aren't a regular user of that site, but you would still like to access
that FTP site, look around, and retrieve files.
So, where it says Name, I type the word
-
anonymous
hit enter, and cross my fingers. If MIT ftp server does not allow anonymous
access, I'm about to find out.
-
Name (rtfm.mit.edu:yoon): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
Good, it's going to let me in. All I have to do is give the site a
password. Out of politeness to the FTP site, if you login as
"anonymous", you need to use your full Internet
address as your password. This helps the FTP site keep track of who has visited
its site. So, since it wants my password, and since the password for any
anonymous FTP session is my full Internet address, I type
-
yoon@Old_Dominion_U.edu
Once I hit enter, my screen fills with the following:
-
230 Guest login ok, access restrictions apply.
ftp>
Notice the line "Guest login ok, access restrictions apply."
This means that the site has given me access, but I only have access to
the files that are available to the general public.
Keep in mind that
NEVER TYPE A PASSWORD THAT YOU USE ON YOUR OWN SYSTEM when
you're accessing an anonymous FTP server. (Each anonymous
connection is logged with user name and password)
Okay ... now what? I've started-up my FTP client, I've given the client
an FTP address to connect to, I've identified myself to the remote site
(I told it that I am anonymous), and I've
given the site my password.
Now it's time to see what sort of files and directories are around, and
to get those files. (BTW, you can see a list of all of the acceptable
commands for your FTP client by typing "help"
or "?")
On most FTP clients, the command to list the contents of the current
directory on the remote machine is just dir.
(Of course, if you're using a GUI-based FTP client, current directory
listing will be automatically displayed)
My FTP client accepts and uses the "dir" command,
so I type
-
ftp> dir
(use Control-H to 'basckspace' or 'Del' in case of mistyping) and the
following appears on my screen:
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 8512
-rw-r--r-- 1 root daemon 0 Feb 3 1998 .k5login
-rw-r--r-- 1 root daemon 0 Jul 29 1996 .klogin
-rw-r--r-- 1 root daemon 0 Apr 14 1993 .notar
-rw-r--r-- 1 root daemon 3443891 Jan 27 08:15 Index-byname
-rw-r--r-- 1 root daemon 483709 Jan 27 08:15 Index-byname.gz
-rw-r--r-- 1 root daemon 3443891 Jan 27 08:15 Index-bytime
-rw-r--r-- 1 root daemon 302454 Jan 27 08:16 Index-bytime.gz
-rw-r--r-- 1 root daemon 249 Feb 3 1998 Index.README
drwxr-x--x 3 root daemon 512 Feb 3 1998 bin
drwxr-x--x 2 root daemon 512 Mar 21 1998 dev
drwxr-x--x 4 root daemon 512 Feb 3 1998 etc
drwxr-xr-x 3 root 70 512 Jan 26 1998 installkits
-rw-r--r-- 1 root daemon 974409 Jan 27 08:27 ls-lR.Z
drwxrwxr-x 36 root system 1536 Aug 30 02:19 pub
drwxr-x--x 4 root daemon 512 Oct 5 1994 usr
226 Transfer complete.
987 bytes received in 0.095 seconds (10 Kbytes/s)
ftp>
|
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:
drwxr-x--x 3 root daemon 512 Feb 3 1998 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,
drwxr-x--x 3 root daemon 512 Feb 3 1998 bin
|
the "drwxr-x--x" tells us that this entry is a subdirectory (the
"rwxr-x--x" part is called a file permission, and it contols
the ownership of this subdirectory, and who can access it).
The "512" tells us the size of the subdirectory in bytes.
The "Feb 3 1998" 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 root daemon 3443891 Jan 27 08:15 Index-byname
|
There is a "-" instead of a "d", so this is a file.
The "3443891" tells us that the size of this file is
3,443,891 bytes (or about 3.36 Megabytes), the file was last updated
on Jan 27 08:15 of current year, and the name of this
file is "Index-byname".
Let's get back to the main directory contents:
total 8512
-rw-r--r-- 1 root daemon 0 Feb 3 1998 .k5login
-rw-r--r-- 1 root daemon 0 Jul 29 1996 .klogin
-rw-r--r-- 1 root daemon 0 Apr 14 1993 .notar
-rw-r--r-- 1 root daemon 3443891 Jan 27 08:15 Index-byname
-rw-r--r-- 1 root daemon 483709 Jan 27 08:15 Index-byname.gz
-rw-r--r-- 1 root daemon 3443891 Jan 27 08:15 Index-bytime
-rw-r--r-- 1 root daemon 302454 Jan 27 08:16 Index-bytime.gz
-rw-r--r-- 1 root daemon 249 Feb 3 1998 Index.README
drwxr-x--x 3 root daemon 512 Feb 3 1998 bin
drwxr-x--x 2 root daemon 512 Mar 21 1998 dev
drwxr-x--x 4 root daemon 512 Feb 3 1998 etc
drwxr-xr-x 3 root 70 512 Jan 26 1998 installkits
-rw-r--r-- 1 root daemon 974409 Jan 27 08:27 ls-lR.Z
drwxrwxr-x 36 root system 1536 Aug 30 02:19 pub
drwxr-x--x 4 root daemon 512 Oct 5 1994 usr
|
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
-
ftp> cd PUB
and the following appears on my screen:
-
ftp> cd PUB
550 PUB: No such file or directory.
ftp>
hmmmm ... what happened? Ah, it's the case of the "PUB!"
Most of FTP servers are
Unix machines, and Unix is by its virtue 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 then
-
ftp> cd pub
and the following appears on my screen:
-
ftp> cd pub
250 CWD command successful.
ftp>
Good! It worked! Now I need to see the contents of this new directory
that I just entered. Do you remember what FTP command was used to
list the current directory?
Then, I type dir, and the following appears on my screen:
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 2554
-rw-r--r-- 1 3382 395 99943 May 23 1990 MAP.PS
drwxr-xr-x 2 3382 395 512 May 30 1993 MulticsMap
-rw-r--r-- 1 3382 15010 67 Sep 17 1988 WorldMap.notes
-rw-r--r-- 1 3382 395 75351 Jun 23 1989 WorldMap.rsalz.shar
-rw-r--r-- 1 3382 15010 1585725 Sep 17 1988 WorldMap.tar.Z
-r--r--r-- 1 root 15010 8139 Oct 3 1986 arpaprob.txt
drwxrwxr-x 2 16256 system 512 Oct 31 1996 bert
-rw-r--r-- 1 8973 15010 106496 Dec 9 1986 brunhoff_doc.tar
drwxrwxr-x 2 8973 system 512 Feb 23 1996 cc-vc
drwxrwxr-x 2 root system 512 Mar 3 1994 cdmm
-rw-r--r-- 1 3382 15010 37807 May 4 1988 chess.ps
drwxrwxr-x 2 3009 system 512 Feb 23 1995 com_err
drwxr-xr-x 2 9978 system 512 Aug 28 1994 compression_apps
*
*
*
lrwxrwxrwx 1 root system 15 Feb 5 1998 usenet -> usenet-by-group
drwxr-xr-x 2 root system 512 Jul 14 1996 usenet-addresses
drwxrwxr-x 2288 3009 3 68096 Jan 28 00:44 usenet-by-group
drwxrwxr-x 126 root 3 2048 Jan 2 00:38 usenet-by-hierarchy
drwxrwxr-x 2 9661 system 512 Nov 27 1996 warlord
drwxr-xr-x 2 7783 15010 512 Jul 20 1998 whois
drwxrwxr-x 3 root system 512 Nov 30 1993 wipe
-rw-r--r-- 1 3382 15010 34721 Apr 1 1988 x11_release
-rw-r--r-- 1 357 15010 5182 Jan 28 1987 x2ps.c
-rw-r--r-- 1 15864 395 63381 Apr 19 1990 xbugchess.tar.Z
drwxrwxr-x 3 3009 system 512 Dec 28 13:19 xrn
drwxrwxr-x 2 root system 512 Sep 7 1993 xscreensaver
drwxr-xr-x 4 3382 395 512 Dec 18 1997 z80
226 Transfer complete.
4025 bytes received in 0.15 seconds (26 Kbytes/s)
ftp>
|
Since I want to know what kind of FAQs are currently available, I will change
to "/pub/usenet/news.answers"
subdirectory. I type
ftp> cd usenet/news.answers
250-| COPYRIGHT NOTICE
250-| ~~~~~~~~~~~~~~~~
250-| Nearly all of the files contained in this directory are copyrighted
250-| by their respective maintainers. (Even files without explicit
250-| copyright notices are copyrighted under the international Berne
250-| Convention, in effect in most countries.) Some of the files,
250-| although certainly not all, prohibit redistribution for any
250-| commercial purposes without prior approval; other kinds of
250-| restrictions may also be imposed by the maintainers.
250-|
250-| Approval for use when there are restrictions imposed must be
250-| obtained from the maintainers of each file, *NOT* from the
250-| maintainers of this archive. If you have any doubts about whether
250-| you may redistribute a particular file for some particular purpose,
250-| contact its author.
250-|
250-| Making a copy for your own personal reading is implicitly allowed.
250-
226 Transfer complete.
ftp>
|
After changed to "/pub/usenet/news.answers", I'd like to make it sure I'm
in the right place. To find where you are, you can use
pwd command which shows the
"present working directory (=pwd)"
on the remote computer.
-
ftp> pwd
257 "/pub/usenet-by-group/news.answers" is currnt directory
ftp>
Very well, I'm in the right place. Now I need to see the contents
of this new directory that I just entered. Do you remember what
FTP command I should use to list the current directory?
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 9228
drwxrwxr-x 417 3009 3 12288 Jan 27 06:05 .
-rw-rw-r-- 1 8027 3 434848 Jan 26 08:53 .#index
drwxrwxr-x 2288 3009 3 68096 Jan 28 00:44 ..
-rw-r--r-- 1 28252 3 639 Jul 17 1995 .message
drwxrwxr-x 2 root 3 512 Oct 14 1997 386bsd-faq
drwxrwxr-x 2 root 3 512 Jul 25 1998 3b1-faq
-rw-rw-r-- 10 99 3 3019 Nov 10 1997 3d-programmer-info
drwxrwxr-x 3 root 3 512 Jul 24 1995 AOL
drwxrwxr-x 2 root 3 512 Jan 8 00:06 AudioFAQ
drwxrwxr-x 4 root 3 512 Sep 16 1997 C++-faq
drwxrwxr-x 2 3009 3 512 Jan 15 11:35 C-faq
drwxrwxr-x 3 root 3 512 Apr 15 1997 CAD
-rw-rw-r-- 6 99 3 80571 Jan 21 06:04 CPM-faq
drwxrwxr-x 2 root 3 512 Jan 16 01:43 GNU-Emacs-FAQ
drwxrwxr-x 2 root 3 512 Jan 25 00:28 LANs
-rw-rw-r-- 10 99 3 53147 Jan 26 00:52 LEGO-faq
-rw-rw-r-- 6 99 3 59345 Jan 20 00:47 Modula-3-faq
-rw-rw-r-- 8 99 3 240539 Apr 11 1998 NeXT-FAQ
drwxrwxr-x 2 root 3 512 Sep 18 00:38 Objective-C
*
*
*
-rw-rw-r-- 6 99 3 68530 Dec 31 00:46 whitewater-addr
drwxrwxr-x 7 root 3 512 Jun 7 1998 windows
drwxrwxr-x 2 root 3 512 Nov 30 00:50 windows-emulation
drwxrwxr-x 3 root 3 512 Jan 1 1995 windows-nt
drwxrwxr-x 2 root 3 512 Jun 28 1998 wine-faq
-rw-rw-r-- 4 root 3 27598 Apr 18 1995 wireless-cable
drwxrwxr-x 4 root 3 512 Oct 12 00:13 woodworking
-rw-rw-r-- 6 99 3 41234 Jan 25 00:25 world-war-2-faq
drwxrwxr-x 4 root 3 512 Jan 26 00:52 writing
drwxrwxr-x 5 root 3 512 Jan 26 09:02 www
drwxrwxr-x 2 root 3 512 Jan 9 00:50 x-faq
-rw-rw-r-- 6 99 3 20909 Jul 30 1997 xanadu-faq
drwxrwxr-x 3 root 3 512 Oct 9 1995 yolo
-rw-rw-r-- 8 99 3 24204 Nov 1 00:42 z-faq
drwxrwxr-x 2 root 3 512 Jan 25 00:28 zoroastrianism
226 Transfer complete.
37160 bytes received in 0.23 seconds (32 Kbytes/s)
ftp>
|
Hmm..., that was a long listing. That first file, .#index, looks what I'm looking for. I bet it
contains some important information and list of FAQs that will make my
life a whole bunch easier (Good rule of thumb: if you see a file that
contains the words INDEX or README, it is an important file). I need to
get this .#index 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 the filename .#index starts with
".," I want to save .#index file
with different name on my computer. To do that, use
-
ftp> get <filename> <name I want it saved as>
command, replacing "<remote file name>" with ".#index," and replacing
<name I want it saved as> with the name that I want the file to
be saved as on my computer.
So, I type
-
ftp> get .#index faq_index
and the following appears on my screen:
-
ftp> get .#index faq_index
200 PORT command successful.
150 Opening ASCII mode data connection for .#index (434848 bytes).
226 Transfer complete.
local: faq.index remote: .#index
441351 bytes received in 3.3 seconds (1.3e+02 Kbytes/s)
ftp>
Great, it worked! Now, to end a FTP session, you need to use
either the "quit" or "bye" commands.
On my client, the command is "quit", so I type
-
ftp> quit
221 Goodbye.
and I'm back to my Unix system prompt.
-
bash:[sparky] ~>
Okay. I got the file.
Looking at this new file that I just got from FTP, I discover that
the contents of the ".#index" file are a brief explanation of what is
in every subdirectory off of the
"/pub/usenet/news.answers"
directory:
386bsd-faq/part1 [comp.unix.bsd] NetBSD, FreeBSD, and
OpenBSD FAQ (Part 1 of 10)
comp.unix.bsd.netbsd.announce,comp.unix.bsd.freebsd. . .
386bsd-faq/part10 [comp.unix.bsd] NetBSD, FreeBSD, and
OpenBSD FAQ (Part 10 of 10)
comp.unix.bsd.netbsd.announce,comp.unix.bsd.freebsd. . .
386bsd-faq/part2 [comp.unix.bsd] NetBSD, FreeBSD, and
OpenBSD FAQ (Part 2 of 10)
comp.unix.bsd.netbsd.announce,comp.unix.bsd.freebsd. . .
386bsd-faq/part3 [comp.unix.bsd] NetBSD, FreeBSD, and
OpenBSD FAQ (Part 3 of 10)
comp.unix.bsd.netbsd.announce,comp.unix.bsd.freebsd. . .
386bsd-faq/part4 [comp.unix.bsd] NetBSD, FreeBSD, and
OpenBSD FAQ (Part 4 of 10)
*
*
*
ftp-list/faq Anonymous FTP: Frequently Asked Questions
(FAQ) List
news.newusers.questions,news.announce.newusers,alt.sources. . .
*
*
*
I want to go back and get "Anonymous FTP: Frequently Asked Questions
(FAQ) List" in the MIT anonymous FTP server (rtfm.mit.edu). Thanks to what I
found from the .#index file,
I now know that the files that I am looking for are in
"/pub/usenet/news.answers" directory
and in the "ftp-list" subdirectory with
file name "faq".
In FTP notation, I can write this as
-
/pub/usenet/news.answers/ftp-list
This means the same thing as saying "in the pub directory,
in the usenet subdirectory, in the news.answers subdirectory, in
the ftp-list subdirectory" and, as you will soon see, this notation
will eventually even save me a few steps.
Let's go back to MIT anonymous FTP server (rtfm.mit.edu) and
get some newsletter articles!
I type
-
bash:[sparky] ~>ftp rtfm.mit.edu
Connected to PENGUIN-LUST.MIT.EDU.
220 rtfm ftpd (wu-2.4(67) with built-in ls); bugs to ftp-bugs@rtfm.mit.edu.
Name (rtfm.mit.edu:yoon): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
230 Guest login ok, access restrictions apply.
ftp>
I know that I want to get into the pub directory, and then into
the usenet subdirectory, then in the news.answers subdirectory, then in
the ftp-list subdirectory. I could type "cd pub"
and then "cd usenet" and then
"cd news.answers" and
then "ftp-list"
to get into the subdirectory that I want, but it would be easier to
just jump into the "ftp-list" directory with one command.
I can make such a jump using the
"cd /pub/usenet/news.answers/ftp-list" all at once.
-
ftp> cd /pub/usenet/news.answers/ftp-list
250 CWD command successful.
ftp>
Since I have no idea what is in the "ftp-list" subdirectory that I
just entered, I type
-
ftp> dir
and the following appears on my screen:
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 62
-rw-rw-r-- 18 99 3 61915 Nov 14 1997 faq
drwxrwxr-x 2 root 3 512 Nov 14 1997 sitelist
226 Transfer complete.
135 bytes received in 0.019 seconds (6.8 Kbytes/s)
ftp>
|
Very well, let's get the faq. Since I want the file "faq" and save it as "ftp.faq" in my Unix account, I type
-
ftp> get faq ftp.faq
and the following appears on my screen:
-
ftp> get faq ftp.faq
200 PORT command successful.
150 Opening ASCII mode data connection for faq (61915 bytes).
226 Transfer complete.
local: ftp.faq remote: faq
63321 bytes received in 0.5 seconds (1.2e+02 Kbytes/s)
ftp>
I then quit FTP by typing either "quit"
or "bye", and I can open the file
"ftp-faq" and learn all about FTP.
|