📄 ch14.htm
字号:
<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>
-->
<H1></H1>
<UL>
<LI><A HREF="#Heading1">- 14 -</A>
<UL>
<LI><A HREF="#Heading2">Communications Tools</A>
<UL>
<LI><A HREF="#Heading3">Using the write Command</A>
<UL>
<LI><A HREF="#Heading4">A Description of the write Command</A>
</UL>
<LI><A HREF="#Heading5">TIP</A>
<UL>
<LI><A HREF="#Heading6">A Sample write Session</A>
</UL>
<LI><A HREF="#Heading7">TIP</A>
<UL>
<LI><A HREF="#Heading8">write Etiquette</A>
</UL>
<LI><A HREF="#Heading9">The talk Communication Tool</A>
<UL>
<LI><A HREF="#Heading10">A Sample talk Session</A>
<LI><A HREF="#Heading11">talk Etiquette</A>
</UL>
<LI><A HREF="#Heading12">Electronic Mail</A>
<UL>
<LI><A HREF="#Heading13">Mailboxes and Agents</A>
<LI><A HREF="#Heading14">Understanding the Mail Message</A>
<LI><A HREF="#Heading15">Types of Mail User Agents</A>
</UL>
<LI><A HREF="#Heading16">Listing 14.1. elms main screen</A>
<LI><A HREF="#Heading17
<LI><A HREF="#Heading18">Listing 14.2. Pines main screen</A>
<LI><A HREF="#Heading19
<LI><A HREF="#Heading20">Listing 14.3. Composing a message.</A>
<LI><A HREF="#Heading21">Listing 14.4. Login notification of received mail</A>
<LI><A HREF="#Heading22
<LI><A HREF="#Heading23">Listing 14.5. Receiving mail</A>
<LI><A HREF="#Heading24
<LI><A HREF="#Heading25">Listing 14.6. Mail options</A>
<LI><A HREF="#Heading26
<LI><A HREF="#Heading27">Listing 14.7. Three received messages</A>
<LI><A HREF="#Heading28
<LI><A HREF="#Heading29">Using news</A>
<UL>
<LI><A HREF="#Heading30">nn</A>
<LI><A HREF="#Heading31">tin</A>
</UL>
<LI><A HREF="#Heading32">TIP</A>
<LI><A HREF="#Heading33">Listing 14.8. A sample tin session</A>
<LI><A HREF="#Heading34
<LI><A HREF="#Heading35">Listing 14.9. Another sample tin session</A>
<LI><A HREF="#Heading36
<LI><A HREF="#Heading37">Using FTP</A>
<UL>
<LI><A HREF="#Heading38">Anonymous FTP</A>
</UL>
<LI><A HREF="#Heading39">TIP</A>
<LI><A HREF="#Heading40">Listing 14.10. An ftp session</A>
<LI><A HREF="#Heading41
<LI><A HREF="#Heading42">NOTE</A>
<LI><A HREF="#Heading43">telnet</A>
<LI><A HREF="#Heading44">Listing 14.11. Logging in via telnet</A>
<LI><A HREF="#Heading45
<LI><A HREF="#Heading46">Listing 14.12. Help for Archie</A>
<LI><A HREF="#Heading47
<LI><A HREF="#Heading48">Listing 14.13. Finding by keyword</A>
<LI><A HREF="#Heading49
<LI><A HREF="#Heading50">Listing 14.14. The output of the Archie command</A>
<LI><A HREF="#Heading51
<LI><A HREF="#Heading52">Summary</A>
</UL>
</UL>
</UL>
<P>
<HR SIZE="4">
<H2 ALIGN="CENTER"><A NAME="Heading1<FONT COLOR="#000077">- 14 -</FONT></H2>
<H2 ALIGN="CENTER"><A NAME="Heading2<FONT COLOR="#000077">Communications Tools</FONT></H2>
<P><I>by Uzma Husain</I></P>
<P>IN THIS CHAPTER</P>
<UL>
<LI>Using the write Command
<P>
<LI>The talk Communication Tool
<P>
<LI>Electronic Mail
<P>
<LI>Using news
<P>
<LI>Using FTP
<P>
<LI>telnet
</UL>
<P><BR>
The communication tools discussed in this chapter include the following:
<UL>
<LI><TT>write</TT>: For one-way communication with other users
<P>
<LI><TT>mesg</TT>: For controlling message reception from other users
<P>
<LI><TT>talk</TT>: For an interactive connection with other users
<P>
<LI>e-mail: For sending and receiving messages
<P>
<LI><TT>telne</TT>t: For logging into remote sites
<P>
<LI><TT>ftp</TT>: For remote file transfers
<P>
<LI><TT>news</TT>: For reading news via <TT>nn</TT> and <TT>tin</TT>
</UL>
<P>This chapter discusses all of these communications tools in detail and gives you
the basics of how to use them in Linux. With practice, you will soon begin to use
these tools effectively.
<H3 ALIGN="CENTER"><A NAME="Heading3<FONT COLOR="#000077">Using the write Command</FONT></H3>
<P>The <TT>write</TT> command is a communication tool that enables a user to interact
directly with other users. If you want to ask your friend a simple question or ask
him out to lunch, and you know that he is logged in, <TT>write</TT> is the tool to
use. Unlike e-mail, which is discussed later, <TT>write</TT> pastes your message
directly on the recipient's terminal who does not have to take any steps to receive
it. To use the <TT>write</TT> command, your terminal and that of the other user should
have <TT>write</TT> permission. Having these permissions enables you to write messages
on each other's terminals. To look at the terminal settings, you need to know which
terminal you are on. To find your terminal number, use the <TT>tty</TT> command as
shown here:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">mpsi:~$ tty
/dev/tty2
mpsi:~$ ls -al /dev/tty2
crw--w--w- 1 calvin users 4, 2 Jan 15 05:49 /dev/tty2
</FONT></PRE>
<P>The preceding code sample shows that I am on <TT>/dev/tty2</TT>. Your output may
be different, depending on which terminal you happen to be on. The output of the
<TT>ls</TT> command shows that others have <TT>write</TT> permission available on
your terminal. You can confirm this by using the <TT>mesg</TT> command as shown here:<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">mpsi:~$
mpsi:~$ mesg
Is y
</FONT></PRE>
<P>The outcome of the <TT>mesg</TT> command shows that the terminal enables messages
to be written to it. You can toggle the terminal settings on and off with the following
command:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">mpsi:~$ mesg n
mpsi:~$ mesg
Is n
</FONT></PRE>
<P>The preceding segment turned the <TT>mesg</TT> off. Now you can't be disturbed
by any other user. (You may miss out on lunch dates, though.)
<H4 ALIGN="CENTER"><A NAME="Heading4<FONT COLOR="#000077">A Description of
the write Command</FONT></H4>
<P>The <TT>write</TT> command enables you to write an actual message on the other
terminal online. You have to issue the <TT>write</TT> command with the login ID of
the user with whom you want to communicate. The <TT>write</TT> command informs the
user at the other end that there is a message from another user. <TT>write</TT> pastes
that message onto the other user's terminal if their terminal's <TT>write</TT> permissions
are set. Even if they are in the middle of an edit session, <TT>write</TT> overwrites
whatever is on the screen. The edit session contents are not corrupted; you can restore
the original screen on most editors with Ctrl-L. <TT>write</TT> is mostly used for
one-way communication, but you can have an actual conversation as well.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading5<FONT COLOR="#000077"><B>TIP:</B> </FONT>For the <TT>write</TT>
command to work, <TT>mesg</TT> has to be turned on, so turn it back on.
<HR>
</DL>
<H4 ALIGN="CENTER"><A NAME="Heading6<FONT COLOR="#000077">A Sample write Session</FONT></H4>
<P>Because you want your friend to be able to write to your <TT>tty</TT> as well,
always begin by checking the status of the <TT>mesg</TT> command:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">mpsi:~$
mpsi:~$ mesg
Is y
</FONT></PRE>
<P>Let's see whether your friend, Calvin, is logged in. You can do this by using
the <TT>who</TT> command and piping it to the <TT>grep</TT> program to search for
Calvin because you don't want the entire list of users to scroll down your terminal.<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">mpsi:~$ who | grep calvin
calvin tty2 Jan 15 15:26
</FONT></PRE>
<DL>
<DT><FONT COLOR="#0066FF"></FONT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading7<FONT COLOR="#000077"><B>TIP: </B></FONT>Don't forget to type
<TT>/dev</TT> before the terminal name. Look at what happens when you don't type
the <TT>/dev</TT> string:<FONT COLOR="#0066FF"></FONT>
</DL>
<DL>
<DD><FONT COLOR="#0066FF">mpsi:~$ ls -l tty2<BR>
ls: tty2: No such file or directory</FONT>
<HR>
<FONT COLOR="#0066FF"></FONT>
</DL>
<PRE><FONT COLOR="#0066FF"></FONT></PRE>
<BLOCKQUOTE>
<P>Oops! All the <TT>tty</TT>s are in <TT>/dev</TT>, so add <TT>/dev</TT> to <TT>tty2</TT>.
</BLOCKQUOTE>
<P>Now let's see whether he wants to be disturbed:</P>
<PRE><FONT COLOR="#0066FF">
mpsi:~$ ls -al /dev/tty2
crw--w--w- 1 calvin users 4, 2 Jan 15 15:28 /dev/tty2
mpsi:~$
</FONT></PRE>
<P>This excerpt shows you that Calvin is indeed logged in. Now let's see whether
he is interested in communicating with a <TT>write</TT> session:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">mpsi:~$ write calvin
</FONT></PRE>
<P>Calvin sees the following on his screen:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">mpsi:~$
Message from laurel@mpsi on tty1 at 15:36 ...
</FONT></PRE>
<P>Now you have to wait for Calvin's response to the request. He responds by typing
the following on his terminal if he is interested in communicating with you:<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">mpsi:~$ write laurel
How are you?
</FONT></PRE>
<PRE><FONT COLOR="#0066FF"> Lunch tomorrow?
</FONT></PRE>
<P>The following string appears on your terminal:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">Message from calvin@mpsi on tty2 at 15:36 ...
How are you?
</FONT></PRE>
<PRE><FONT COLOR="#0066FF"> Lunch tomorrow?
</FONT></PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -