⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 290-292.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:FTP and Telnet</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=15//-->

<!--PAGES=290-292//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="288-290.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="292-295.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading6"></A><FONT COLOR="#000077">FTP Commands</FONT></H4>

<P>Once you have connected to a remote system, you want to move about the directory structure and transfer files. An FTP user has a number of commands available; the most frequently used commands are summarized in Table 15.1. These commands are usually used only with character-based FTP clients, as the GUI-based clients use menu items for these functions.

</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 15.1.</B> FTP <TT>user commands</TT>.

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TH WIDTH="30%" ALIGN="LEFT">FTP Command

<TH WIDTH="70%" ALIGN="LEFT">Description

<TR>

<TD COLSPAN="2"><HR>

<TR>

<TD><TT>ascii</TT>

<TD>Switch to ASCII transfer mode

<TR>

<TD><TT>binary</TT>

<TD>Switch to binary transfer mode

<TR>

<TD><TT>cd</TT>

<TD>Change directory on the server

<TR>

<TD><TT>close</TT>

<TD>Terminate the connection

<TR>

<TD><TT>del</TT>

<TD>Delete a file on the server

<TR>

<TD><TT>dir</TT>

<TD>Display the server directory

<TR>

<TD><TT>get</TT>

<TD>Fetch a file from the server

<TR>

<TD><TT>hash</TT>

<TD>Display a pound character for each block transmitted

<TR>

<TD><TT>help</TT>

<TD>Display help

<TR>

<TD><TT>lcd</TT>

<TD>Change directory on the client

<TR>

<TD><TT>mget</TT>

<TD>Fetch several files from the server

<TR>

<TD><TT>mput</TT>

<TD>Send several files to the server

<TR>

<TD><TT>open</TT>

<TD>Connect to a server

<TR>

<TD><TT>put</TT>

<TD>Send a file to the server

<TR>

<TD><TT>pwd</TT>

<TD>Display the current server directory

<TR>

<TD><TT>quote</TT>

<TD>Supply an FTP command directly

<TR>

<TD><TT>quit</TT>

<TD>Terminate the FTP session

<TR>

<TD COLSPAN="2"><HR>

</TABLE>

<P>The primary file transfer commands are <TT>get</TT> and <TT>put</TT>. Remember that all commands are relative to the client (the machine you issue the commands on), so a <TT>get</TT> command moves a file from the server to the client whereas a <TT>put</TT> command puts a file from the client to the server.</P>

<P>Character-based FTP clients show how this works quite easily. Consider the following example:</P>

<!-- CODE SNIP //-->

<PRE>

get autoexec.bat

705 bytes received in 0.1 seconds (0.00 kbytes/s)

</PRE>

<!-- END CODE SNIP //-->

<P>Here the user has logged in to a remote machine, then issued a <TT>get</TT> command to transfer the file <TT>autoexec.bat</TT> from the remote (which is a Windows FTP server) to the local client. As you can see, the FTP client issues a status report showing the size of the file and the amount of time it took to transfer.</P>

<P>The <TT>mget</TT> and <TT>mput</TT> commands are similar to <TT>get</TT> and <TT>put</TT>, but they transfer more than one file at a time. For example, the command:</P>

<!-- CODE SNIP //-->

<PRE>

mget config.*

</PRE>

<!-- END CODE SNIP //-->

<P>will transfer all the files name <TT>config.*</TT> from the FTP server to the local client&#146;s directory. For each file that matches the pattern, the server prompts to make sure you want to transfer it.</P>

<P>You can move around the remote machine using the <TT>cd</TT> command to change directories and <TT>pwd</TT> to print the current directory (these are UNIX commands). Note that if you are on a client UNIX machine, the UNIX<TT>/</TT> must be used instead of the DOS <TT>\</TT> character to indicate directory changes. Again, you have to know the operating system of the remote machine to prevent problems.</P>

<P>File access rights and permissions are always considered by FTP when files are transferred and you move into other directories. If you do not have the proper permissions as set by the server, you can&#146;t perform the action, and you will see an error message.</P>

<H4 ALIGN="LEFT"><A NAME="Heading7"></A><FONT COLOR="#000077">File Transfer Modes</FONT></H4>

<P>FTP was developed in the early days of TCP/IP, when practically all files were ASCII format. When binaries had to be transferred (a binary defined as any file that did not have the regular ASCII characters), the mode of the transfer had to be manually changed from ASCII (often called text) to binary. FTP enables file transfers in several formats, which are usually system-dependent. The majority of systems (including UNIX systems) have only two modes: text and binary. Some mainframe installations add support for EBCDIC, while many sites have a local type that is designed for fast transfers between local network machines. (The local type may use 32- or 64-bit words.)

</P>

<P>To change the format of the file transfers to allow you to move any file other than a text file, you must first make sure FTP is in binary mode with this command:</P>

<!-- CODE SNIP //-->

<PRE>

bin

</PRE>

<!-- END CODE SNIP //-->

<P>You can return to character mode with the command

</P>

<!-- CODE SNIP //-->

<PRE>

ascii

</PRE>

<!-- END CODE SNIP //-->

<P>It&#146;s important to be aware of which mode you are in. Linux FTP, by default, usually starts in character (ASCII) mode.

</P>

<P>Text transfers use ASCII characters separated by carriage-return and newline characters, whereas binary enables transfer of characters with no conversion or formatting. Binary mode is faster than text and also enables for the transfer of all ASCII values (necessary for non-text files). On most systems FTP starts in text mode, although many system administrators now set FTP to binary mode for their users&#146; convenience. FTP cannot transfer file permissions, as these are not specified as part of the protocol. Some FTP clients and servers can detect the type of file and adjust themselves accordingly. If in doubt, use binary.</P>

<P>Usually there are no keyboard shortcuts (such as pressing the Tab key to fill in names that match) available with FTP. This means you have to type in the name of files or directories in their entirety (and correctly). If you misspell a file or directory name, you will get error messages and have to try again. Luckily, if you are performing the FTP session through an X Window or Windows environment, you can cut and paste lines from earlier in your session.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="288-290.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="292-295.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 + -