Files
oldlinux-files/docs/Install-Guide/install-guide-2.2.2/node239.html
2024-02-19 00:23:35 -05:00

110 lines
5.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>C.4 Downloading files</TITLE>
</HEAD>
<BODY>
<meta name="description" value="C.4 Downloading files">
<meta name="keywords" value="gs">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<BR> <HR><A NAME=tex2html4832 HREF="node240.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html4830 HREF="node235.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html4824 HREF="node238.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html4834 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html4835 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4833 HREF="node240.html">C.5 Quitting FTP</A>
<B>Up:</B> <A NAME=tex2html4831 HREF="node235.html">C FTP Tutorial and </A>
<B> Previous:</B> <A NAME=tex2html4825 HREF="node238.html">C.3 Poking Around</A>
<BR> <HR> <P>
<H1><A NAME=SECTION001040000000000000000>C.4 Downloading files</A></H1>
<P>
Before downloading files, there are a few things that you need to take care
of.
<UL><LI> <b>Turn on hash mark printing.</b> <em>Hash marks</em> 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 (<tt>#</tt>), and one is printed for every
1024 or 8192 bytes transferred, depending on your system.
<P>
To turn on hash mark printing, give the command <tt>hash</tt>.
<P><TT> ftp&gt; <em>hash</em> <BR>
Hash mark printing on (8192 bytes/hash mark). <BR>
ftp&gt;
<P></TT>
<P>
<LI> <b>Determine the type of file which you are downloading.</b>
As far as FTP is concerned, files come in two flavors: <em>binary</em> and
<em>text</em>. 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 <tt>README</tt>s and so on) are text files.
<P>
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.
<P>
The commands <tt>bin</tt> and <tt>ascii</tt> set the transfer mode to binary and
text, respectively. <em>When in doubt, always use binary mode to transfer
files</em>.
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
filenames often end in <tt>.txt</tt>).
<P>
For our example, we're downloading the file <tt>README</tt>, which is
most likely a text file, so we use the command
<P><TT> ftp&gt; <em>ascii</em> <BR>
200 Type set to A. <BR>
ftp&gt;
<P></TT>
<P>
<LI> <b>Set your local directory.</b> Your <em>local directory</em> is the
directory on your system where you want the downloaded files to end up.
Whereas the <tt>cd</tt> command changes the remote directory (on the remote
machine which you're FTPing to), the <tt>lcd</tt> command changes the local
directory.
<P>
For example, to set the local directory to <tt>/home/db/mdw/tmp</tt>, use
the command
<P><TT> ftp&gt; <em>lcd /home/db/mdw/tmp</em> <BR>
Local directory now /home/db/mdw/tmp <BR>
ftp&gt;
<P></TT></UL>
<P>
Now you're ready to actually download the file. The command
<P><TT> get <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img309.gif"> <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img310.gif"> <P></TT>
is used for this, where <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img311.gif">
is the name of the
file on the remote machine, and <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img312.gif">
is the name
that you wish to give the file on your local machine. The
<IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img313.gif"> argument is optional; by default,
the local filename is
the same as the remote one. However, if for example you're downloading
the file <tt>README</tt>, and you already have a <tt>README</tt> in your local
directory, you'll want to give a different
<IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img314.gif">
so that
the first one isn't overwritten.
<P>
For our example, to download the file <tt>README</tt>, we simply use
<P><TT> ftp&gt; <em>get README</em> <BR>
200 PORT command successful. <BR>
150 ASCII data connection for README (128.84.181.1,4527) (1433 bytes). <BR>
# <BR>
226 ASCII Transfer complete. <BR>
local: README remote: README <BR>
1493 bytes received in 0.03 seconds (49 Kbytes/s) <BR>
ftp&gt;
<P></TT><BR> <HR><A NAME=tex2html4832 HREF="node240.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html4830 HREF="node235.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html4824 HREF="node238.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html4834 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html4835 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4833 HREF="node240.html">C.5 Quitting FTP</A>
<B>Up:</B> <A NAME=tex2html4831 HREF="node235.html">C FTP Tutorial and </A>
<B> Previous:</B> <A NAME=tex2html4825 HREF="node238.html">C.3 Poking Around</A>
<BR> <HR> <P>
<BR> <HR>
<P><ADDRESS>
<I>Matt Welsh <BR>
mdw@sunsite.unc.edu</I>
</ADDRESS>
</BODY>