📄 0193-0196.html
字号:
<HTML>
<HEAD>
<TITLE>Sams Teach Yourself Linux in 24 Hours:Internet Downloading and Browsing:EarthWeb Inc.-</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311623 //-->
<!-- TITLE=Sams Teach Yourself Linux in 24 Hours//-->
<!-- AUTHOR=Bill Ball//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=13 //-->
<!-- PAGES=0193-0210 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="../ch12/0190-0192.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0197-0199.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-193"><P>Page 193</P></A>
<H3><A NAME="ch13_ 2">
Hour 13
</A></H3>
<H2>
<A NAME="ch13_ 3">Internet Downloading and Browsing
</A>
</H2>
<P>This hour introduces you to programs you'll use to get information
and programs from the Internet. I'll assume that you have signed up with
an Internet Service Provider (ISP) and that you have configured your
Linux system to start and stop Point-to-Point Protocol network connections.
</P>
<A NAME="PAGENUM-194"><P>Page 194</P></A>
<TABLE BGCOLOR=#FFFF99><TR><TD>JUST A MINUTE</TD></TR><TR><TD>
<BLOCKQUOTE>
If you already have an account with a local ISP, but have not configured
your Linux system to connect to the Internet, read Hour 10, "Connecting to
the Internet," for instructions.
</BLOCKQUOTE>
</TD></TR></TABLE>
<P>I'll first introduce you to two Internet file transfer programs, and then cover some of
the many World Wide Web browsers you'll find for Linux.
</P>
<H3><A NAME="ch13_ 4">
Using File Transfer Protocol Programs to Get Files
</A></H3>
<P>There are several ways to retrieve files from other computers on the Internet. You can
use email or a Web browser, but if you're interested in just getting files into your
computer, you can use the ftp (file transfer) program. The
ftp program is one of the oldest programs to support the standard File Transfer Protocol, or FTP, and was the original
program designed to transfer files. The FTP protocol lets you send and receive files interactively
with the get and put commands.
</P>
<P>The next section shows you how to use two FTP transfer programs,
ftp and ncftp.
</P>
<H4><A NAME="ch13_ 5">
Retrieving Files with the ftp Command
</A></H4>
<P>The ftp command, found under the /usr/bin directory, has five different
command-line options, but is most often used with a hostname, or name of remote computer, for example:
</P>
<!-- CODE SNIP //-->
<PRE>
# ftp ftp.mcp.com
</PRE>
<!-- END CODE SNIP //-->
<P>This command line specifies that you want to connect to the
ftp server at Macmillan Publishing. You don't have to specify a hostname on the command line, because you
can run the ftp program interactively, repeatedly connecting and disconnecting to
different computers. The ftp command has more than 70 different built-in commands, including
a help facility. This hour doesn't cover all the different commands, but you can get
more information about these commands by reading the
ftp program's manual page, or by using the built-in
help command.
</P>
<P>Some of the commands you'll most likely use, especially when all you want to do is
retrieve some programs or source code from Linux sites, are
</P>
<BLOCKQUOTE>
!—Prompt for and run a shell command. This is a handy way to view the
contents of files, delete files you've just downloaded, or check on how much hard drive
space you have left.<BR>
ascii—Download any specified files in text form.
<BR>
binary—Download any specified files in binary form. You must use this
command before downloading most compressed Linux files.
</BLOCKQUOTE>
<A NAME="PAGENUM-195"><P>Page 195</P></A>
<BLOCKQUOTE>
bye—Close any open connection, and exit the
ftp program.<BR>
cd—Change directories, for example:
<BR>
<!-- CODE SNIP //-->
<PRE>
> cd ..
</PRE>
<!-- END CODE SNIP //-->
<BR>
close—Close the current connection.<BR>
get—Download a specific file from the current directory to your current
directory, for example:
<BR>
<!-- CODE SNIP //-->
<PRE>
> get killbarney.tgz
</PRE>
<!-- END CODE SNIP //-->
<BR>
ls—List files or directories in the current directory.<BR>
mget—Download several files, one after another, that match a
specified pattern, for example:
<BR>
<!-- CODE SNIP //-->
<PRE>
> mget kill*.tgz
</PRE>
<!-- END CODE SNIP //-->
<BR>
open—Opens a connection to a specified host, for example:
<BR>
<!-- CODE SNIP //-->
<PRE>
> open ftp.mcp.com
</PRE>
<!-- END CODE SNIP //-->
</BLOCKQUOTE>
<P>For example, to run the ftp command interactively, all you have to do is type
</P>
<!-- CODE //-->
<PRE>
# ftp
ftp> help
Commands may be abbreviated. Commands are:
! debug mdir sendport site
$ dir mget put size
account disconnect mkdir pwd status
append exit mls quit struct
ascii form mode quote system
bell get modtime recv sunique
binary glob mput reget tenex
bye hash newer rstatus tick
case help nmap rhelp trace
cd idle nlist rename type
cdup image ntrans reset user
chmod lcd open restart umask
close ls prompt rmdir verbose
cr macdef passive runique ?
delete mdelete proxy send
ftp> help exit
exit terminate ftp session and exit
ftp> help bye
bye terminate ftp session and exit
ftp> bye
#
</PRE>
<P>
<CENTER>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
CAUTION
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
If you have enforced disk quotas for users of your Linux system, users
can
</BLOCKQUOTE></TD></TR>
</TABLE></CENTER>
</P>
<A NAME="PAGENUM-196"><P>Page 196</P></A>
<TABLE BGCOLOR=#FFFF99><TR><TD></TD></TR><TR><TD>
<BLOCKQUOTE>
easily exceed the quota you've enforced, especially when downloading
large files. One way to help users on a quota-enforced system is to tell them to
first change directory to the /tmp directory if using
ftp, and to then open a connection to download any large files. The
/tmp directory will be cleaned out by your housekeeping
crontab routines later on to make more room on your hard drive,
but your users will be able to download large files without hitting hard limits on
their quotas.
</BLOCKQUOTE></TD></TR></TABLE>
<P>To demonstrate the ftp program in action, I'll show you a sample session:
</P>
<!-- CODE //-->
<PRE>
# ftp ftp.mcp.com
Connected to ftp.mcp.com.
220 iq-mcp FTP server (Version wu-2.4(3) Thu Jun 12 14:38:11 EST 1997) ready.
Name (ftp.mcp.com:bball): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 14
drwxr-xr-x 7 root other 512 Dec 4 20:01 .
drwxr-xr-x 7 root other 512 Dec 4 20:01 ..
d--x--x--x 3 root other 512 Dec 4 18:44 bin
dr-xr-xr-x 2 root other 512 Dec 4 18:44 dev
d--x--x--x 2 root other 512 Dec 4 21:13 etc
drwxr-xr-x 31 672 anon-ftp 1024 Dec 8 14:17 pub
dr-xr-xr-x 3 root other 512 Dec 4 20:01 usr
226 Transfer complete.
ftp> cd pub
250 CWD command successful.
ftp> cd software
250 CWD command successful.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 168
drwxrwxr-x 24 232 19 1024 Dec 4 19:40 .
drwxr-xr-x 31 672 anon-ftp 1024 Dec 8 14:17 ..
drwxrwxr-x 3 232 19 512 Dec 4 19:34 CAD
drwxrwxr-x 3 232 19 1024 Dec 4 19:36 Internet
-rw-rw-r-- 1 232 19 7570 Jul 9 14:58 MANUALIN.TXT
drwxrwxr-x 2 232 19 512 Dec 4 19:36 WordProc
-rwxrwxr-x 1 232 19 47981 Jun 29 1995 aaplay.exe
drwxrwxr-x 2 232 19 512 Dec 4 19:40 adstuff
drwxrwxr-x 2 232 19 512 Dec 4 19:40 brady
drwxrwxr-x 2 232 19 1536 Dec 4 19:36 database
-rwxr-xr-x 1 19 19 42 Dec 20 1996 erp
drwxrwxr-x 2 232 19 1024 Dec 4 19:37 games
</PRE>
<!-- END CODE //-->
<P><CENTER>
<a href="../ch12/0190-0192.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0197-0199.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -