Библиотека сайта или "Мой Linux Documentation Project"
Next: About this document Up: No Title Previous: No Title
The File Transfer Protocol (FTP) is the set of programs used for
transferring files between systems on the Internet. Most Unix,
VMS, and MS-DOS systems on the Internet have a program called
which you use to transfer these files, and if you have Internet access, the
best way to download the Linux software is by using
ftp. This appendix
ftp usage--of course, there are many more functions and
ftp than are given here.
At the end of this appendix there is a listing of FTP sites where
Linux software can be found. Also, if you don't have direct Internet
access but are able to exchange electronic mail with the Internet,
information on using the
ftpmail service is included below.
If you're using an MS-DOS, Unix, or VMS system to download files from the
ftp is a command-driven program. However, there are
other implementations of
ftp out there, such as the Macintosh version
Fetch) with a nice menu-driven interface, which is quite
self-explanatory. Even if you're not using the command-driven version of
ftp, the information given here should help.
ftp can be used to both upload (send) or download (receive) files
from other Internet sites. In most situations, you're going to be downloading
software. On the Internet there are a large number of publicly-available
FTP archive sites, machines which allow anyone to
ftp to them and
download free software. One such archive site is
has a lot of Sun Microsystems software, and acts as one of the main Linux
sites. In addition, FTP archive sites mirror software to each
other--that is, software uploaded to one site will be automatically copied
over to a number of other sites. So don't be surprised if you see the exact
same files on many different archive sites.
Note that in the example ``screens'' printed below I'm only showing the most important information, and what you see may differ. Also, commands in italics represent commands that you type; everything else is screen output.
ftp and connect to a site, simply use the command
where hostname is the name of the site you are connecting to. For example, to connect to the mythical site
shoop.vpizza.com we can use the command
ftp starts up we should see something like
ftp is asking us to give the username that we want to login as
shoop.vpizza.com. The default here is
mdw, which is my username
on the system I'm using FTP from. Since I don't have an account on
shoop.vpizza.com I can't login as myself. Instead, to access
publicly-available software on an FTP site you login as
give your Internet e-mail address (if you have one) as the password.
So, we would type
Of course, you should give your e-mail address, instead of mine, and it won't echo to the screen as you're typing it (since it's technically a ``password'').
ftp should allow us to login and we'll be ready to
Okay, we're in.
ftp> is our prompt, and the
ftp program is
waiting for commands. There are a few basic commands you need to know about.
First, the commands
both give file listings (where file is an optional argument specifying a particular file name to list). The difference is that
usually gives a short listing and
dir gives a longer listing (that
is, with more information on the sizes of the files, dates of modification,
and so on).
will give help on the given
cd). If no command is specified,
ftp will list all of the
If we type
dir at this point we'll see an initial directory
listing of where we are.
Each of these entries is a directory, not an individual file which we can
download (specified by the
d in the first column of the listing).
On most FTP archive sites, the publicly available software is under the
/pub, so let's go there.
Here we can see a number of (interesting?) files, one of which is called
README, which we should download (most FTP sites have a
file in the
Before downloading files, there are a few things that you need to take care of.
- Turn on hash mark printing. Hash marks are printed to the
screen as files are being transferred; they let you know how far along the
transfer is, and that your connection hasn't hung up (so you don't sit
for 20 minutes, thinking that you're still downloading a file). In general,
a hash mark appears as a pound sign (
#), and one is printed for every 1024 or 8192 bytes transferred, depending on your system.
To turn on hash mark printing, give the command
- Determine the type of file which you are downloading.
As far as FTP is concerned, files come in two flavors: binary and
text. Most of the files which you'll be downloading are binary files:
that is, programs, compressed files, archive files, and so on. However,
many files (such as
READMEs and so on) are text files.
Why does the file type matter? Only because on some systems (such as MS-DOS systems), certain characters in a text file, such as carriage returns, need to be converted so that the file will be readable. While transferring in binary mode, no conversion is done--the file is simply transferred byte after byte.
asciiset the transfer mode to binary and text, respectively. When in doubt, always use binary mode to transfer files. If you try to transfer a binary file in text mode, you'll corrupt the file and it will be unusable. (This is one of the most common mistakes made when using FTP.) However, you can use text mode for plain text files (whose file names often end in
For our example, we're downloading the file
README, which is most likely a text file, so we use the command
- Set your local directory. Your local directory is the
directory on your system where you want the downloaded files to end up.
cdcommand changes the remote directory (on the remote machine which you're FTPing to), the
lcdcommand changes the local directory.
For example, to set the local directory to
/home/db/mdw/tmp, use the command
Now you're ready to actually download the file. The command
is used for this, where remote-name is the name of the file on the remote machine, and local-name is the name that you wish to give the file on your local machine. The local-name argument is optional; by default, the local file name is the same as the remote one. However, if for example you're downloading the file
README, and you already have a
README in your local
directory, you'll want to give a different
the first one isn't overwritten.
For our example, to download the file
README, we simply use
To end your FTP session, simply use the command
can be used to close the connection with the current remote FTP site; the
open command can then be used to start a session with another
site (without quitting the FTP program altogether).
ftpmail is a service which allows you to obtain files from FTP
archive sites via Internet electronic mail. If you don't have direct
Internet access, but are able to send mail to the Internet (from a service
such as CompuServe, for example),
ftpmail is a good way to get
files from FTP archive sites. Unfortunately,
ftpmail can be
slow, especially when sending large jobs. Before attempting to download
large amounts of software using
ftpmail, be sure that your
mail spool will be able to handle the incoming traffic. Many systems
keep quotas on incoming electronic mail, and may delete your account
if your mail exceeds this quota. Just use common sense.
sunsite.unc.edu, one of the major Linux FTP archive sites,
is home to an
ftpmail server. To use this service, send
electronic mail to
with a message body containing only the word:
This will send you back a list of
ftpmail commands and a brief
tutorial on using the system.
For example, to get a listing of Linux
files found on
sunsite.unc.edu, send mail to the above address
containing the text
You may use the
ftpmail service to connect to any FTP archive
site; you are not limited to
sunsite.unc.edu. The next section lists
a number of Linux FTP archives.
The table on page is a listing of the most well-known FTP archive sites which carry the Linux software. Keep in mind that many other sites mirror these, and more than likely you'll run into Linux on a number of sites not on this list.
the ``home sites'' for the Linux software, where most of the new software
is uploaded. Most of the other sites on the list mirror some combination of
these three. To reduce network traffic, choose a site that is geographically
closest to you.
Next: About this document Up: No Title Previous: No Title Clarica Grove
Fri Feb 20 04:53:33 PST 1998
Только зарегистрированные пользователи могут оценивать и комментировать статьи.