📄 585-588.html
字号:
<HTML>
<HEAD>
<TITLE>Special Edition Using Linux, Fourth Edition:Accessing the Network with telnet, ftp, and the r-Commands</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=0789717468//-->
<!--TITLE=Special Edition Using Linux, Fourth Edition//-->
<!--AUTHOR=Jack Tackett//-->
<!--AUTHOR=Jr.//-->
<!--AUTHOR=Steve Burnett//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=30//-->
<!--PAGES=585-588//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="583-585.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="588-590.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B>Local Commands While in FTP</B></FONT></P>
<P>The ! character is used to pass a command to the command shell on your local computer while you’re in FTP. This can be very useful if you need to do something while you’re in the midst of an FTP session. Suppose that you need to create a directory to hold received files. If you enter <TT>!mkdir new_dir</TT>, Linux makes a directory named new_dir in your current local directory.</P>
<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">A Sample FTP Session</FONT></H4>
<P>Listing 30.1 shows a short FTP session.
</P>
<P><B>Listing 30.1</B> Making an FTP Connection and Getting a Directory Listing</P>
<!-- CODE //-->
<PRE>
$ <B>ftp opus</B>
Connected to opus.
220 opus FTP server (Linux opus 2.0.6 #4 Mon Nov 11 16:01:33 CDT 1996)
ready.
Name (opus:smith): <B>smith</B>
Password (opus:smith): <B>password</B>
331 Password required for smith.
230 User smith logged in.
Remote system type is UNIX.
Using ASCII mode to transfer files.
ftp> <B>dir</B>
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 8
-rw-r--r-- 1 root daemon 1525 Sep 29 15:37 README
dr-xr-xr-x 2 root wheel 512 Jun 24 11:35 bin
dr--r--r-- 2 root wheel 512 Jun 24 11:18 dev
dr--r--r-- 2 root wheel 512 Jun 24 11:24 etc
dr-xr-xr-x 4 root wheel 512 Sep 29 15:37 pub
dr-xr-xr-x 3 root wheel 512 Jun 24 11:15 usr
-r--r--r-- 1 root daemon 461 Jun 24 13:46 welcome.msg
226 Transfer complete.
433 bytes received in 0.027 seconds (16 Kbytes/s)
ftp> <B>get README</B>
200 PORT command successful.
150 Opening ASCII mode data connection for README (1525 bytes).
226 Transfer complete.
local: README remote: README
1561 bytes received in 0.0038 seconds (4e+02 Kbytes/s)
ftp> <B>quit</B>
221 Goodbye.
$
</PRE>
<!-- END CODE //-->
<P>In the preceding example, a user opens an FTP session to the host opus and logs in as smith. The remote FTP server prompts for the password, which the user types (the password doesn’t appear on-screen). <TT>ftp</TT> then logs smith in to the remote system and displays the <TT>ftp></TT> prompt for interactive mode commands. The user tells <TT>ftp</TT> to list the remote directory with the <TT>dir</TT> command and then transfers the file README with the <TT>get</TT> command. When finished with the FTP session, the intrepid user then logs out with the <TT>quit</TT> command and is returned to the local Linux shell prompt.</P>
<H4 ALIGN="LEFT"><A NAME="Heading9"></A><FONT COLOR="#000077">A Sample Anonymous FTP Session</FONT></H4>
<P>In the previous section, you saw a user initiate an FTP session with a system and look at some directories. The user had a valid username and password on the remote system. Now look at an anonymous FTP session to a major software archive site on the Internet. Listing 30.2 is very similar to Listing 30.1, but it has some interesting differences.
</P>
<P><B>Listing 30.2</B> Performing an Anonymous FTP Connection</P>
<!-- CODE //-->
<PRE>
$ <B>ftp ftp.uu.net</B>
Connected to ftp.uu.net.
220 ftp.UU.NET FTP server (Version wu-2.4(1) Wed Nov 13 15:45:10 EST 1996)
ready.
Name (ftp.uu.net:bubba): <B>anonymous</B>
331 Guest login ok, send your complete e-mail address as password.
Password: <B>your_e-mail_address</B>
230-
230- Welcome to the UUNET archive.
230- A service of UUNET Technologies Inc, Falls Church, Virginia
230- For information about UUNET, call +1 703 204 8000,
230- or see the files in /uunet-info
230-
230- Access is allowed all day.
230- Local time is Wed Nov 13 15:53:02 1996.
230-
230- All transfers are logged with your host name and email address.
230- If you don’t like this policy, disconnect now!
230-
230- If your FTP client crashes or hangs shortly
230- after login, try using a
230- dash (-) as the first character of your password.
230- This will turn off the informational messages which may
230- be confusing your ftp client.
230-
230-Please read the file /info/README.ftp
230- it was last modified on Mon Nov 11 17:39:53 1996 - 2 days ago
230 Guest login ok, access restrictions apply.
ftp>
ftp> <B>dir</B>
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 4149
drwxr-sr-x 2 34 0 512 Jul 26 1992 .forward
-rw-r--r-- 1 34 uucp 0 Jul 26 1992 .hushlogin
-rw-r--r-- 1 34 archive 59 Jul 31 1992 .kermrc
-rw-r--r-- 1 34 archive 0 Jul 26 1992 .notar
drwx--s--x 5 34 archive 512 Jul 23 19:00 admin
lrwxrwxrwx 1 34 archive 1 Jul 26 1992 archive ->.
drwxrws--x 4 0 archive 512 Apr 20 16:29 bin
lrwxrwxrwx 1 34 archive 23 Sep 14 1993 by-name.gz ->
index/master/by-name.gz
lrwxrwxrwx 1 34 archive 23 Sep 14 1993 by-time.gz ->
index/master/by-time.gz
-rw-r--r-- 1 34 archive 90112 Apr 26 1991 compress.tar
lrwxrwxrwx 1 0 archive 9 Jul 23 18:50 core -> /dev/null
drwxrws--x 2 0 archive 512 Jul 26 1992 dev
drwxrwsr-x 21 34 archive 1024 Sep 29 15:18 doc
drwxrws--x 6 0 archive 512 Apr 14 16:42 etc
lrwxrwxrwx 1 34 archive 31 Dec 8 1993 faces ->
/archive/published/usenix/faces
drwxrwsr-x 2 34 archive 512 Jul 26 1992 ftp
drwxrwsr-x 4 34 archive 512 Sep 29 10:34 government
drwxrwsr-x 18 34 archive 1024 Sep 29 10:28 graphics
-rw-rw-r-- 1 27 archive 798720 Jul 11 20:54 gzip.tar
lrwxrwxrwx 1 34 archive 17 Jul 26 1992 help ->
info/archive-help
drwxrwsr-x 20 34 archive 1024 Dec 2 1993 index
drwxrwsr-x 19 34 archive 512 Sep 29 10:30 inet
drwxrwsr-x 4 34 archive 512 Sep 29 15:36 info
drwxrwsr-x 25 34 archive 512 Sep 29 10:29 languages
drwxrwsr-x 4 34 archive 512 Sep 29 10:28 library
drwx--s--x 2 0 0 8192 Jul 26 1992 lost+found
lrwxrwxrwx 1 34 archive 20 Aug 2 1992 ls-lR.Z ->
index/master/ls-lR.Z
lrwxrwxrwx 1 34 archive 21 Sep 14 1993 ls-lR.gz ->
index/master/ls-lR.gz
lrwxrwxrwx 1 34 archive 21 Aug 2 1992 ls-ltR.Z ->
index/master/ls-ltR.Z
lrwxrwxrwx 1 34 archive 22 Sep 14 1993 ls-ltR.gz ->
index/master/ls-ltR.gz
drwxrwsr-x 24 34 archive 1024 Sep 29 15:10 networking
drwxrwsr-x 2 34 archive 512 Aug 10 09:26 packages
d--xrws--x 17 34 archive 512 Sep 26 12:29 private
drwxrwsr-x 25 34 archive 1536 Sep 29 15:30 pub
drwxrwsr-x 17 34 archive 1024 Sep 29 15:38 published
lrwxrwxrwx 1 34 archive 10 Jul 26 1992 sco-archive ->
vendor/sco
drwxrwsr-x 20 34 archive 512 Sep 29 04:18 systems
drwxrwxrwx 14 34 archive 1536 Sep 29 15:36 tmp
lrwxrwxrwx 1 34 archive 17 Jul 26 1992 unix-today ->
vendor/unix-today
lrwxrwxrwx 1 34 archive 17 Jul 26 1992 unix-world ->
vendor/unix-world
drwxrwsr-x 36 34 archive 1024 Sep 29 15:29 usenet
drwxrws--x 6 0 archive 512 Oct 22 1992 usr
lrwxrwxrwx 1 34 archive 16 Aug 2 1992 uumap
-> networking/uumap
-rw-rw-r-- 1 34 archive 3279895 Sep 28 21:05 uumap.tar.Z
drwxrwsr-x 3 210 archive 2560 Sep 29 15:36 uunet-info
drwxrwsr-x 64 34 archive 1536 Sep 29 10:29 vendor
226 Transfer complete.
3257 bytes received in 0.76 seconds (4.2 Kbytes/s)
ftp>
ftp> <B>cd systems/unix/linux</B>
250-Files within this subtree are automatically mirrored from
250-tsx-11.mit.edu:/pub/linux
250-
250 CWD command successful.
ftp>
ftp> <B>binary</B>
200 Type set to I.
ftp> <B>get sum.Z</B>
200 PORT command successful.
150 Opening BINARY mode data connection for sum.Z (80959 bytes).
226 Transfer complete.
local: sum.Z remote: sum.Z
80959 bytes received in 5.6 seconds (14 Kbytes/s)
ftp> <B>quit</B>
221 Goodbye.
$
</PRE>
<!-- END CODE //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="583-585.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="588-590.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -