Detailed FTP Guide

Contributed by Jeff Pfohl

As promised here is the step by step procedure for walking around in
the archive site at I do not guarantee that it
will work for everyone since each system has its own little quirks.
Please direct all comments to me: I do
not intend to cover all the directories in the archive site for this
example. I will purposely walk through several directories to give you
the basic feel for it.  All you need to do is change the directory
names and file names to use the rest of the archive.  I begin my
telling a little about the archive, defining terms and defining
commands. This will allow us to go through an example as you would at
the site. If you do not understand what we did refer back to the
command list. At times I will reiterate what the command has done to
help give you a better feel for what we are doing. Yes this is, at
times, redundant but it is a good way to help solidify the commands in
your minds. This has proven to be useful in the past so bear with me
at the beginning and it will all be clear at the end (I hope).  This
example is a little long but purposely so in order to try to be
comprehensive.  One last comment about this example. You SHOULD be
able to follow the example blindly treating the computer and its
commands as a black box.  You will only get to see and save the parts
which we visit together but it is possible. I do NOT recommend
following blindly since I personally like to understand everything I
do but that's just me :).


I will denote the prompt for the local site as "LOCAL>"
The prompt for the archive/foreign site is "ftp>"
ALL commands are CASE SENSITIVE!!!!!!!
everything that is enclosed in ' ' is what is printed on your screen
			by the computer that I feel is relevant to future
			steps or to the step just completed. It is NOT
			everything that is shown on your screen as that
			will be too time consuming to type out. 


When I say: = I mean:
local site = the machine where you are
foreign site = the archive site (caltech)
fname = a file which you are interested in or want to create
dname = a directory you are interested in or want to create

lcd dname = local directory change (changes directory at the local site
		to dname)

lcd .. = change to the previous local site directory

cd .. = change to the previous foreign sire directory (ie go back one directory)

lcd = takes you to the home directory at the local site 

lcd dname = local directory change (changes directories at the
		foreign site to dname) 

cd dname = foreign directory change (changes directories at the foreign
		site to dname) 

The following 3 commands: ls, ls -F, and dir have the following
If your prompt is 'ftp>' then you get the list of files at the
foreign site'. If your prompt is 'LOCAL>' then you get the list of
files at the local site.

ls = listing of contents in the current directory 

ls -F = listing of contents in the current directory indicating which
		are directories with a /

dir = a listing of contents that also SHOWS THE SIZE of each entry.
		Directories are denoted by a d on the far left.
		Useful command if your local site has limited space.

get = command used to transfer files from the foreign site to the
		local site

mget *  = command used to transfer multiple files of the form "fname"
		from the current foreign directory to the current local directory

mget *.* = command used to transfer multiple files of the form
		"fname.something" from the current foreign directory to
		the current local directory. This will NOT copy
		directory structures, ONLY THE FILES. You must first
		create the directories in your account (the local
		site) BEFORE you ftp.

prompt = during mget commands your machine may or may not ask you
		whether you want each file. This command toggles this
		feature on and off for your convenience. I'll explain
		more when we get to mget in our example. 

get fname |more = allows you to read the file before deciding to get
		it. You can page down by hitting the space bar. You
		cannot page up! 

mkdir dname = make a directory at the local site called dname. You
		must use this command only at a LOCAL> prompt since you are not 
		authorized to alter the archive site.

pwd = ask the computer to tell you what directory you are in at the
		foreign site when prompt is "ftp>" and at the local site when the
		prompt is "LOCAL>"

quit = used at the ftp> prompt to end the session and return you to
		your local site

[ctrl] xc = allows you to stop the reading process of a "get fname
		|more" or to stop a "mget *" or "mget *.*" command. The
		[ctrl] key must be held down while x and c are
		typed!!! You do NOT need a prompt to use this command!!

WARNING: Sometimes this command will hang your local machine up. Other
commands you  might also try if this happens are: "[ctrl] c" and "q"
although "q" will not stop the mget processes.


At the local site you need to create a directory where you will save
the archive. I'll call it Fish and save it in my home directory (ie
the directory you are in when you first log in): /home . 

LOCAL> mkdir Fish
LOCAL> cd Fish

I recommend that you walk through the archive site first and see the
directories that are there. Then quit the archive and at the local
site create those directories in the Fish directory. Only then go back
to the archive site and start saving files. I personally like to open
another window at the local site and make local directories in that
window so I never need to leave the archive site but will not do so
for this example since not everyone has windows capabilities.  For
this example we will create 2 more directories for convenience: Fresh
and Salt which are directories in the Fish directory.

LOCAL> mkdir Fresh
LOCAL> mkdir Salt

Now connect to the archive site

LOCAL> ftp
	'Name (site information):' anonymous
	'Password:" your email address

ftp> cd pub/aquaria
ftp> dir

Note that there is only one file in this directory. All the rest are
other directories.
In deference to those who actually wrote the archive I will now have
you read the README file. It is also a good place to start. (I guess
that is why they want us to read it)

ftp> get README |more

Recall that you page down using the space bar and CANNOT page up!

ftp> ls

Following the advice of the README file.

ftp> cd Info
ftp> pwd
	'"/pub/aquaria/Info" is current directory'
ftp> dir
ftp> get contents |more
ftp> get contents

This gives you the directory tree of the archive so you can see how it
is set up. This is when I would leave the archive and set up more
directories at the local site according to this directory tree. We
will not do this but rather stick to our simple directory hierarchy
with Salt and Fresh being subdirectories of Fish. (No need to make
this more complicated that it already is. Or any longer:) ) 

ftp> cd ..
ftp> pwd
	'"/pub/aquaria" is current directory'

Note that the /Info is now gone from our previous pwd command. The
cd .. command has thus done its job and taken us back one directory.

ftp>cd reefs

We want to save saltwater stuff in the Salt directory.

ftp>lcd Salt
	'Local directory now /home/Fish/Salt'

ftp>ls -F

In this directory we note that other directories are designated by
capitalizing the first letter while files are all lowercase. This is a
nice feature and occurs elsewhere in the archive but unfortunately is
not a hard and fast rule. 

Let's read and then get a file.

ftp> get liverock |more

ftp> get liverock

Long pause while it transfers the file from the remote to local site.

Let's say that we want to get all the files and then read them later.
This is nice since it does not tie up the archive and we can read at
our leisure. Assuming your local system prompts you for every file
with an mget command you'll see:

ftp> mget *
	'mget berlin?' y
	'mget calcium?' n
This continues until you go through all the files in a yes or no
format. To stop in the middle do the following:

	'mget calendar?' [ctrl] xc
	'continue with mget?" n

Remember to hold down the control key while typing BOTH x and c!!
Also remember the warning about this command stated previously!

If the filename is one part like "berlin" then we use "mget *" but if
the filename is two parts like "fname.something" then we need to
emulate the syntax and use "mget *.*".

One last note is that some systems do not prompt you automatically in
the yes/no format but instead just transfer ALL the files in that
directory to your local directory. If this is the case AND you want to
be prompted before transferring files (you only want a few of them)
then simply type the word "prompt" (no quotes) followed by a [return]
at the 'ftp>' prompt BEFORE doing an mget. Finally the "prompt"
command is an on/off toggle so if you are getting prompted and would
prefer not to be prompted then simply type the word "prompt" at
'ftp>' followed by a [return].

Let's check out the Mailorder directory

ftp> cd Mailorder
ftp> pwd
	'"/pub/aquaria/reefs/Mailorder is current directory'
ftp> ls
ftp> get chemicals |more

We decide not to get this file arbitrarily. We thus go back to the
reefs directory.

ftp> cd ..

We can now explore one of the other directories: Corals, Parameters,
Reproduction, Systems or go back to the aquaria directory.
We choose to go back to the aquaria directory.

ftp> cd ..
ftp> pwd
	'"pub/aquaria" is current directory'

Where is the Reefkeepers FAQ you ask?

ftp> ls -F
ftp> cd FAQfiles
ftp> ls -F
ftp> cd Reefkeepers
ftp> ls

There it is. Since it is known to be long let's just get it from the
archive to our local machine and read it later. We get the entire
thing as one file. You could get each part separately by replacing
".all" with ".part 1" and then again with ".part2" etc. or use the
command "mget *.*" since the filename is in two parts.

ftp> get reefkeepersFAQ.all

We now want to look at some freshwater stuff just to be fair to as
many people as possible. (and more importantly to learn new commands)

ftp> pwd
	'"/pub/aquaria/FAQfiles/Reefkeepers" is current directory

ftp> cd /pub/aquaria

Note that since we knew what directory we wanted (ie we were not just
looking around to see what was there) we just went directly to that
directory. We could also have done the following with the same effect:
		ftp> cd ..
		ftp> cd ..

since this brings us back two directories.

However our local site directory is /home/Fish/Salt. We definitely
want to save freshwater stuff in the Fresh directory. We thus change
directories at our local site.

ftp> lcd ..
	'Local directory now /home/Fish'

ftp> lcd Fresh
	'Local directory now /home/Fish/Fresh'

ftp> cd fresh
ftp> ls
ftp> get waterchange |more

We can follow the same procedure as we did in the saltwater stuff to
get and read files. Let's check out the directory: "Systems" which we
know to exist from our previous ls command. If you forgot, just type ls
again at the ftp> prompt. 

ftp> cd Systems
ftp> ls
ftp> get boothSST |more

A rather long file. We do not feel like reading it right now. In order
to stop reading it type:

		[ctrl] xc
We are interested in its contents however. Let's get the file for
future reading.

ftp> get boothSST

Long pause as before.

We are now done looking around the archive for this example. 

ftp> quit


Let's look to make sure we got all the files we wanted.

LOCAL> pwd

Notice we are in the directory we started off in before we ftp'd. All
the directory changes during the ftp session have not affected where
we end up. You will ALWAYS be in the same directory in which you
started the ftp session when you end the ftp session.

LOCAL> ls -F

We should see the file: "contents" and the two directories (indicated
by a /) "Fresh" and "Salt".

LOCAL> cd Salt

We should see all the files we decided to get and put in the Salt
directory: liverock, berlin, reefkeepersFAQ.all.

LOCAL> cd ..
LOCAL> cd Fresh

We should see the file boothSST.

LOCAL> cd ..
LOCAL> cd ..
LOCAL> pwd


The official home site of the FAQ is maintained by Erik Olson as part of the The Krib.