Interacting with the World

Much of what you've learned in this book has been about how you can exploit UNIX to be more productive. Now it's time to learn how to communicate with others, to learn about what I consider the “killer app” of UNIX: electronic mail.

Task 19.1: Enabling Messages Using mesg

Earlier you learned that all peripherals hooked up to UNIX are controlled by device drivers and that each device driver has an associated /dev file. If you want to talk with other users on the system, you need to ensure that they can communicate with you too. (This pertains only to talk, however; email works regardless of the mesg setting.)


  1. To find out through what device I'm connected to the system, I can use the UNIX command tty:

    % tty
    /dev/ttyAo
    

    The tty device is just another UNIX file, so I can look at it as I'd look at any other file:

    % ls -l /dev/ttyAo
    crw---x---  1 taylor    21,  71 Dec  8 10:34 /dev/ttyAo*
    

    Notice that I own the file and that I have write permission, but others do not.

  2. To enable other users to communicate with me directly, I need to ensure that they can run programs that can write to my terminal. That is, I need to give them write permission to my tty device. Instead of using the chmod command—tracking down what line I'm on and all that—I use a simple alternative, mesg. To turn messages on—allowing other users to communicate with me—I specify the y flag to mesg:

    % mesg y
    % ls -l `tty`
    crw-rwx---  1 taylor    21,  71 Dec  8 10:33 /dev/ttyAo*
    

    To disable messages (perhaps if I'm busy and don't want to be bothered), I can use the n flag, which says that no, I don't want messages:

    % mesg n
    % ls -l `tty`
    crw---x---  1 taylor    21,  71 Dec  8 10:34 /dev/ttyAo*
    
  3. At any point, you can double-check your current terminal write permission by entering mesg without any flags. The output is succinct, but it tells you what you want to know:

    % mesg
    is n
    

To see the settings of your tty, use the backquotes with the tty command, as shown in the preceding examples.


Don't tell anyone this secret. Once you have write permission to someone else's terminal, you can redirect the output of commands to their tty device as easily as to any other file in UNIX. In fact, that's how the write command works: It opens the other person's tty device for writing, and each line you enter is also written to the other person's screen. I note this simply so that you can see why the permissions of your /dev/tty line are so important, not so that you can go wild and start tormenting your fellow UNIX users!


Task 19.2: Writing to Other Users with write

Now that you can allow others to write to your terminal as well as prevent them from writing to it, it's time to find out how to chat with them using the talk command. talk is quite slick because it splits your screen into two windows: The top window shows what you're saying to the other party, and the bottom window shows what they're typing. Unlike with many online discussion and “chat” systems, however, both people can type simultaneously, which can be quite fun!


What's even more valuable about the talk command is that you can actually interact directly with users on other, remote computers too! You don't need to guess whether they're online, however; to see who is logged in to a remote system, you can use a command called finger, which by default will show you a summary of who is on the local machine. Add a username to the command, and it will show information about the specified account. Specify a user on a remote system, and you can find out whether that user is logged in. Specify just the remote site, and it shows you who is logged in at the current moment. To check on a local account, use finger accountname. To make it a remote system, append the hostname: finger [email protected]. To check all users on a remote site, use finger @host.domain.

  1. A quick glance at the output of who shows that a lot of people are currently logged in to the local system:

    % finger
    Login         Name                TTY Idle    When    Location
    root     root                     *co 1:13 Mon 18:02
    taylor   Dave Taylor               aV      Mon 16:49
    kippje   Jeff Kip                  Ab      Mon 16:41
    adamr    Adam Coy                 *Ae      Mon 18:36
    daffnelr Lawrence Daff             sK      Mon 12:45  (dov27)
    tsa      Earl the Unctuous Aardva  sL   42 Mon 12:48  (expert)
    daffnelr Lawrence Daff            *sM      Mon 12:49  (localhost)
    ben      Ben Moon                  sN 8:42 Mon 09:16  (corona)
    ben      Ben Moon                  sR 8:47 Mon 09:22  (corona)
    marteldr David Martel             *sY   7d Mon 18:41  (limbo)
    gerlema  David Geman               sb      Mon 18:38  (mac19)
    mk       Michael Kenzie           *sc 2:48 Mon 08:07  (mk)
    mzabel   Mary Zabeliski           *sf      Mon 18:45  (sun1)
    fritzg   Geoff Fritzen             sh    9 Mon 18:45  (pc43)
    brynta   Bryan Ayerson            *si      Mon 18:46  (limbo)
    deckersl Sharon Deck               sk    3 Mon 18:51  (xds31)
    
  2. To learn more about the account mk, I can specify that account name to the finger program:

    % finger mk
    
    Login name: mk           (messages off) Real name: Michael Kenzie
    Office: Math 204                        Home phone:
    Directory: /users/mk                    Shell: /bin/ksh
    Universe: universe(ucb)
    Member of groups: utech root actadmin source
    On since Dec 13 08:07:12 on ttysc from mk
    2 hours 50 minutes Idle Time
    No unread mail on this host.
    Plan:
    

    You can see that this is full of information. Notice that Michael is currently logged in to the system (the output says On since Dec 13 08:07:12 on ttysc).

  3. To see who is logged in to the USENIX Association main computer in Berkeley, California, I can use this:

    % finger @usenix.org
    [usenix.org]
    Login       Name              TTY Idle    When    Where
    pmui     Peter Mui             co   2d Tue 10:10
    ah       Alain Henon           Z5      Mon 15:58  remote # 5408955
    Dia
    toni     Toni Veglia           p1   3d Thu 17:09  exec
    diane    Diane DeMartini       p3    9 Mon 08:41  mac2.usenix.ORG
    mis      Mark Seiden           p4   3d Thu 21:46  seiden.com
    mis      Mark Seiden           p5   2d Fri 15:18  msbnext.internex
    scott    Scott Seebass         p6   3d Tue 14:54  biohazard
    lilia    Lilia Carol Scott     p7 1:12 Mon 08:39  thing1
    mis      Mark Seiden           p8   3d Thu 22:09  seiden.com
    toni     Toni Veglia           pa   3d Mon 10:38  exec
    ellie    Ellie Young           q1 1:00 Mon 10:33  boss:0.0
    scott    Scott Seebass         q2  18: Wed 15:36  biohazard
    ellie    Ellie Young           q3 1:01 Mon 10:33  boss:0.0
    mis      Mark Seiden           q6   1d Fri 11:28  seiden.com
    

    Here you can see that lots of folks are logged in but almost everyone has a lot of idle time. A d suffix indicates the number of days idle. So you can see that Peter Mui's account has been idle for two days.

To find out what the weather is like in the greater San Francisco area, try finger [email protected], which will connect you to the Lawrence Livermore National Laboratories in Walnut Creek, California.


  1. To talk with someone on a remote system, use finger to verify that the person is logged in, not off doing something else (which is what a high idle time usually suggests), and then use talk:

    % finger [email protected]
    Login name: marv                        In real life: Marvin Raab
    Directory: /u1/marv                     Shell: /bin/csh
    Logged in since Mon Dec  6 15:22 on ttys8
    5 seconds idle time
    Mail last read Mon Dec 13 15:22:22 1993
    No Plan.
    % talk [email protected]
     [Waiting for your party to respond]
    
    
    
    
    
    
    
    
    ------------------------------------------------------------------------
    ---
    

    On the remote system, here's what Marvin sees:

    Message for marv(ttyaV) from [email protected] at 18:55 ...
    talk: connection requested by [email protected].
    talk: respond with: "talk [email protected]"
    

    Once he responds, the screen looks like this:

    [Connected]
    Hello Marv!  Have you seen the latest news on CNN?
    -
    
    
    
    
    
    
    
    ---------------------------------------------------------------------
    ---
    Hi Dave! What's going on?
    

    Notice that the cursor is in the top pane. Anything I enter will, character by character, be sent along to Marvin, so we can interactively chat and even type at the same time without our words getting jumbled. When I'm done, I simply press ^C to quit the program.

The finger program offers further information about users on your own and remote systems, and using it is an essential first step in talking with your friends on the Internet via talk. Try entering [email protected], and if I'm logged in, what the heck! Try using talk to say hi interactively.


talk is a great tool for interacting with others, but because there are a couple of different versions of the program that are usually incompatible with each other, using it can be frustrating. You'll know that things aren't working correctly when you see “waiting for permission” messages over and over again. A lower-tech alternative for talking with people on your own system is the more primitive write command. Try “man write” to learn more about how to use it.


Task 19.3: Reading Electronic Mail with mailx

The write command is helpful for those situations when your friend or colleague is logged in to the computer at the same time you are, but what do you do if the person is not logged in and you want to leave a note? What if you want a friend to receive a copy of a note you're sending to, say, your boss?


That's where electronic mail moves into the spotlight. Of all the capabilities of UNIX, one of the most popular is undoubtedly this capability to send electronic mail to another user—even on another computer system—with a few keystrokes. In this section, you learn how to work with other users on your own computer, and later in this hour you learn how to send mail to folks who are on different computers, even in different countries.

Various programs for reading mail can be used on UNIX systems, but the two most common are mail and Mail. (The latter is also often called mailx on SVR4 systems.) Because of the similarity of the names, the former is known as “mail” and the latter as either “cap mail” (“cap” for the uppercase M) or “Berkeley Mail.” I refer to “Mail” either as Berkeley Mail or as its AT&T name, mailx. You should never use mail to read or write mail if Berkeley Mail is available to you because Berkeley Mail is much easier to use. I will focus on using Berkeley Mail.

To envision electronic mail, imagine that you have a butler who is friendly with the local post office. You can hand him mail with only the name of the recipient written on the envelope, and the butler will make sure that it's delivered. If new mail arrives, the butler discreetly lets you know about it, so you can then display the messages, one by one, and read them. Furthermore, your butler organizes your old mail in a big filing cabinet, filing each message by any criteria you request.

That's almost exactly how Berkeley Mail works. To send mail, you simply state on the command line the account name of the recipient, indicate a subject, enter the message itself, and poof! Your message is sent through the system and arrives at the recipient's terminal posthaste. When mail arrives for you, the C shell or one of various utilities, such as biff or newmail, can notify you. Each time you log in, the system checks for electronic mail, and if you have any, the system will say You have mail or You have new mail. You can save mail in files called mail folders.

Berkeley Mail has many command options, both flags that you can specify when you invoke the program from the command line, and commands used within the program. Fortunately, you always can enter help while you're in the program to review these options. The most noteworthy flags are -s subject, which enables you to specify the subject of the message on the command line, and -f mail folder, which enables you to specify a mail folder to read rather than the default (which is your incoming mailbox).

The most valuable commands to use within the program are summarized in Table 19.1.

Table 19.1. Berkeley Mail Command Summary
Command Meaning
delete msgs Mark the specified messages for deletion.
headers Display the current page of headers (the cryptic lines of information at the top of an email message; I explain them a bit later in this lesson). Add a + to see the next page, or a - to see the preceding page.
help Display a summary of Berkeley Mail commands.
mail address Send mail to the specified address.
print msgs Show the specified message or messages.
quit Leave the Berkeley Mail program.
reply Respond to the current message.
save folder Save the current message to the specified mail folder.
undelete msgs Undelete the messages you've specified for deletion using the delete command.

  1. I have lots of electronic mail in my mailbox. When I logged in to the system today, the shell indicated that I had new mail. To find out what the new messages are, I use mailx (though I also could have typed Mail because they're synonymous on my machine):

    % mailx
    Mail version 5.2 6/21/85.  Type ? for help.
    "/usr/spool/mail/taylor": 9 messages 5 new
        1 disserli Mon Nov 22 19:40  54/2749 "Re: Are you out there somewhe"
    >N  2 Laura.Ramsey Tue Nov 30 16:47  46/1705 "I've got an idea..."
     N  3 ljw      Fri Dec  3 22:57  130/2712 "Re: Attachments to XALT mail"
     N  4 sartin   Sun Dec  5 15:15  15/341 "I need your address"
     N  5 rustle   Tue Dec  7 15:43  29/955 "flash cards"
        6 harrism  Tue Dec  7 16:13  58/2756 "Re: Writing Lab OWL project ("
        7 CBUTCHER Tue Dec  7 17:00  19/575 "Computer Based GRE's"
        8 harrism  Tue Dec  7 21:46  210/10636 "Various writing environments"
     N  9 v892127  Wed Dec  8 07:09  38/1558 "Re: Have you picked up the co"
    & -
    

    I have lots of information here. On the first line, the program identifies itself as Mail version 5.2, built June 21, 1985. Somewhat tucked away in that top corner is the reminder that I can type ? at any point to get help on the commands.

    The second line tells me what mailbox I'm reading. In this case, I'm looking at the default mailbox for my incoming mail, which is /usr/spool/mail/taylor. On your system, you might find your mailbox in this directory, or you might find it in a directory similarly named /usr/mail. Either way, you don't have to worry about where it's located because Berkeley Mail can find it automatically.

    The 3rd through 11th lines list mail messages I have received from various people. The format is N in the first column if I haven't seen the piece of mail before, a unique index number (the first item in each listing is one), the account that sent the message, the date and time the message was sent, the number of lines and characters in the message, and the subject of the message, if known. Figure 19.1 illustrates this more clearly.

    Figure 19.1. Understanding the message display in mailx.

  2. To read a specific message, I need enter only the index number of that message:

    & 7
    Message  7:
    From: CBUTCHER Tue Dec  7 17:00:28 1998
    From: Cheryl <CBUTCHER>
    Subject:      Computer Based GRE's
    To: Dave Taylor <TAYLOR>
    
    I've scheduled to take the computer based GRE's in Indy on Jan. 6th.
    Call me crazy but someone's got to do it.  I'll let you know how it
    goes.
    
    Do you know anyone else that has taken the GRE's this way?  I figure
    there's a paper in it somewhere.......
    
    If you have that handout from seminar in a file, could you please send
    it
    to me?
    
    Thanks.
    
    & -
    

    This message is from my friend Cheryl Butcher. Collectively, the first set of lines in the message—each a single word, a colon, and some information or other—is the header of the message, or the electronic equivalent of the postmark and envelope. The header always will include From:, Subject:, and To:, specifying the name and electronic address of the sender, the subject of the message, and the list of recipients.

  3. To respond to this message, I enter reply:

    & reply
    To: CBUTCHER
    Subject: RE: Computer Based GRE's
    
    -
    

    Anything I now enter will be sent back to Cheryl:

    								Hi. I am very interested in hearing about your reaction to the
    								computer-based GRE test. I'm sure you're correct that there is
    								a paper there, but wouldn't it be best to work with ETS on the
    								project?
    								I'll dig around and find those handouts soonest.
    								Happy holidays!
    
    Dave
    							

    To end the message, I either press ^d on its own line, or use the shorthand . by itself:

    .
    Cc: -
    

    Berkeley Mail is now asking me to specify any other people I might like to have receive carbon copies of this message. Entering an account name or two here will allow the designated people to see a copy of this message to Cheryl. Because I don't want anyone else to read this message, I press Return, which sends the message and returns me to the & prompt:

    & -
    
  4. I now can use the headers command to see what is the current message (the one I just read). It's the message indicated by the >. (Look at Figure 19.1 if you're having trouble finding it.)

    & headers
        1 disserli Mon Nov 22 19:40  54/2749 "Re: Are you out there
    somewhe"
        2 Laura.Ramsey Tue Nov 30 16:47  46/1705 "I've got an idea..."
     N  3 ljw      Fri Dec  3 22:57  130/2712 "Re: Attachments to XALT mail"
     N  4 sartin   Sun Dec  5 15:15  15/341 "I need your address"
     N  5 rustle   Tue Dec  7 15:43  29/955 "flash cards"
        6 harrism  Tue Dec  7 16:13  58/2756 "Re: Writing Lab OWL project ("
    >   7 CBUTCHER Tue Dec  7 17:00  19/575 "Computer Based GRE's"
        8 harrism  Tue Dec  7 21:46  210/10636 "Various writing environments"
     N  9 v892127  Wed Dec  8 07:09  38/1558 "Re: Have you picked up the co"
    & -
    

    To save Cheryl's message in a folder, I use the save command:

    & save cheryl
    "cheryl" [New file] 19/575
    & -
    
  5. Now that I'm done with this message, I can mark it for deletion with the delete command:

    & delete 7
    &
    

    Notice that after I enter headers, Cheryl's message vanishes from the list:

    & headers
        1 disserli Mon Nov 22 19:40  54/2749 "Re: Are you out there
    somewhe"
        2 Laura.Ramsey Tue Nov 30 16:47  46/1705 "I've got an idea..."
     N  3 ljw      Fri Dec  3 22:57  130/2712 "Re: Attachments to XALT mail"
     N  4 sartin   Sun Dec  5 15:15  15/341 "I need your address"
     N  5 rustle   Tue Dec  7 15:43  29/955 "flash cards"
        6 harrism  Tue Dec  7 16:13  58/2756 "Re: Writing Lab OWL project ("
    >   8 harrism  Tue Dec  7 21:46  210/10636 "Various writing environments"
     N  9 v892127  Wed Dec  8 07:09  38/1558 "Re: Have you picked up the co"
    &
    

    Look closely at the list, and you will see that it hasn't completely forgotten the message; the program hides message 7 from this list. I could still read the message by using print 7, and I could use undelete 7 to pull it off the deletion list.

Deleted messages in Berkeley Mail are actually marked for future deletion and aren't removed until you quit the program. Once you quit, however, there's no going back. A deleted message is gone. While you're within the program, you can delete and undelete to your heart's content.


  1. Now I want to delete both of the messages from harrism (numbers 6 and 8):

    & delete 6 8
    							

    Now the list of messages in my mailbox is starting to look pretty short:

    & h
        1 disserli Mon Nov 22 19:40  54/2749 "Re: Are you out there somewhe"
        2 Laura.Ramsey Tue Nov 30 16:47  46/1705 "I've got an idea..."
     N  3 ljw      Fri Dec  3 22:57  130/2712 "Re: Attachments to XALT mail"
     N  4 sartin   Sun Dec  5 15:15  15/341 "I need your address"
     N  5 rustle   Tue Dec  7 15:43  29/955 "flash cards"
    >N  9 v892127  Wed Dec  8 07:09  38/1558 "Re: Have you picked up the co"
    &
    

Most commands in Berkeley Mail can be abbreviated to just their first letter, which cuts down on typing.


  1. You can save a group of messages to a file by specifying the numbers between the save command and the folder name:

    & save 6 8 harris
    6: Inappropriate message
    

    Oops. I had deleted messages 6 and 8. I must undelete them before I can proceed:

    & undelete 6 8
    & save 6 8 harris
    "harris" [New file] 268/13392
    
  2. Use the quit command to get out of this program:

    & quit
    Saved 1 message in mbox
    Held 6 messages in /usr/spool/mail/taylor
    %
    

    The messages that I viewed and didn't delete are moved out of my incoming mailbox to the file mbox. The messages I saved and the messages I marked for deletion are silently removed, and all remaining messages are retained in /usr/spool/mail/taylor.

The biggest complaint I have with Berkeley Mail is that it does all this activity silently. I don't like the fact that saved messages are deleted automatically from the incoming mailbox when I quit and that—more importantly—messages I've read are tossed automatically into another folder. To ensure that messages you've read aren't moved into mbox when you quit, you can use the preserve command, which you can use with a list of numbers, the same way you can use other Berkeley Mail commands. Any message with which you use preserve will remain in your incoming mailbox.


Once you get the hang of it, Berkeley Mail offers quite a lot of power, enabling you to read through your electronic mail, save it, and respond as needed with ease. The program has considerably more commands than are shown here, so further study is helpful.


Task 19.4: Sending Mail with mailx

Now you know how to read your electronic mail using Berkeley Mail (mailx), and you know how to send mail from within the program. How do you send messages and files to people from the command line? It's quite simple. You even can specify the message subject with the -s starting flag.


  1. To send a message to someone, enter the name of the command followed by the recipient's account name:

    % mail marv
    Subject: Interested in lunch tomorrow?
    -
    

    I now can enter as many lines of information as I want, ending, as within the Berkeley Mail program itself, with either ^d or .:

    								I'm going to be in town tomorrow and would like to
    								rustle up some Chinese food. What's your schedule
    								look like?
    								Dave
    .
    Cc: -
    

    Again, I'm offered the option of copying someone else, but—again—I opt not to do so. Pressing Return sends the message.

  2. To send a file to someone, combine file redirection with the use of the -s flag:

    % mail -s "here's the contents of sample.file" marv < sample.file
    							

    The file was sent without any fuss.

  3. Even though Berkeley Mail gives you no indication, several commands are available for use while you're entering the text of a message, and all can be listed with ~?:

    % mail dunlaplm
    Subject: Good morning!
    ~?
    -----------------------------------------------------------
    The following ~ escapes are defined:
    ~~              Quote a single tilde
    ~b users        Add users to "blind" cc list
    ~c users        Add users to cc list
    ~d              Read in dead.letter
    ~e              Edit the message buffer
    ~h              Prompt for to list, subject and cc list
    ~m messages     Read in messages, right shifted by a tab
    ~p              Print the message buffer
    ~r file         Read a file into the message buffer
    ~s subject      Set subject
    ~t users        Add users to to list
    ~v              Invoke display editor on message
    ~w file         Write message onto file.
    ~?              Print this message
    ~!command       Invoke the shell
    ~|command       Pipe the message through the command
    -----------------------------------------------------------
    -
    

    The ones most important to remember are ~v, to start vi in the message; ~r, to read in a file; ~h, to edit the message headers; ~!, to invoke a shell command; and ~p, to show the message that's been entered so far:

       I wanted to wish you a cheery good morning!  You asked about
    the contents of that one file, so here it is:
    ~!ls
    Archives/          bin/               deleteme           sample
    InfoWorld/         buckaroo           dickens.note       sample2
    Mail/              buckaroo.confused  keylime.pie        src/
    News/              cheryl             mbox               temp/
    OWL/               csh.man            newsample
    awkscript          dead.letter        owl.c
    !
    

    The output of the command isn't included in the message, as is shown if you use the ~p command:

    ~p
    -------
    Message contains:
    To: taylor
    Subject: Good morning!
    
    
    Linda,
    
       I wanted to wish you a cheery good morning!  You asked about
    the contents of that one file, so here it is:
    (continue)
    -
    
  4. To read in a file, use the ~r command:

    ~r dickens.note
    "dickens.note" 28/1123
    

    Here, the contents of the file are included in the note, but mailx didn't list the contents to the screen. Again, using ~p will list the current message:

    -------
    Message contains:
    To: taylor
    Subject: Good morning!
    
    
    Linda,
    
       I wanted to wish you a cheery good morning!  You asked about
    the contents of that one file, so here it is:
    
                                    A Tale of Two Cities
                                          Preface
    
    When I was acting, with my children and friends, in Mr Wilkie
    Collins's
    drama of The Frozen Deep, I first conceived the main idea of this
    story.  A strong desire came upon me then, to
    embody it in my own person;
    and I traced out in my fancy, the state of mind of which it would
    necessitate the presentation
    to an observant spectator, with particular
    care and interest.
    
    As the idea became familiar to me, it gradually shaped itself into
    its
    present form.  Throughout its execution, it has had complete
    possession
    of me; I have so far verified what
    is done and suffered in these pages,
    as that I have certainly done and suffered it all myself.
    
    Whenever any reference (however slight) is made here to the condition
    of the Danish people before or during the Revolution, it is truly
    made,
    on the faith of the most trustworthy
    witnesses.  It has been one of my hopes to add
    something to the popular and picturesque means of
    understanding that terrible time, though no one can hope
    to add anything to the philosophy of Mr Carlyle's wonderful book.
    
    Tavistock House
    November 1859
    (continue)
    
  5. I can fine-tune the headers using the ~h command:

    ~h
    To: dunlaplm-
    

    Pressing Return leaves it as is, and pressing Backspace lets me change it as desired. A Return moves to the next header in the list:

    Subject: Good morning!
    

    Pressing Return a few more times gives me the opportunity to change other headers in the message:

    Cc:
    Bcc:
    (continue)
    

    The Cc: header allows me to specify other people to receive this message. The Bcc: is what's known as a blind carbon copy, an invisible copy of the message. If I send a message to dunlaplm and a carbon copy to cbutcher, each can see that the other received a copy because the message will have To: dunlaplm as a header and also will list the other's name after Cc:. If I want to send a copy to someone without any of the other parties knowing about it, that's where a blind carbon copy can be helpful. Specifying someone on the Bcc: list means that that person receives a copy of the message, but his or her name doesn't show up on any header in the message itself.

  6. Finally, I use ^d to end the message.

    ^d
    Cc:
    %
    

All so-called tilde commands (so named because they all begin with the ~, or tilde, character) are available when you send mail from the command line. They also are available when you send mail while within the Berkeley Mail program.


Task 19.5: Internet Email Addresses

The most common use of the Internet is probably to send electronic mail between individuals and to mailing lists. What's really a boon is that everyone, from New York to Los Angeles, Japan to Germany, South Africa to India, has an address that's very similar, and you've already seen it shown here. The notation is user@host. domain, where user is the account name or full name, host is the name of the user's machine, and domain is the user's location in the world.


By reading the host and domain information from right to left (from the outside in, really), you can decode information about someone by looking at the person's email address. My address at a system called Netcom, for example, is [email protected], which, reading right to left, tells you that I'm at a commercial site (com) with a company by the name of Netcom (netcom), and the name of the computer I'm using is netcom2. My account on Netcom is taylor.

There are lots of top-level domains; the most common are shown in Table 22.1.

Table 22.1. Common Top-Level Internet Domains
Domain Type of Site or Network
edu Educational sites
com Commercial businesses
mil Military or defense systems
net Alternative networks accessible via Internet
org Nonprofit organizations
us United States systems not otherwise classified

  1. To send mail to someone on the Internet is easy. If you'd like to send me a message, for example, you could use this:

    % mailx [email protected]
    Subject: -
    

    Enter the message and end with a ^d as you would in any email message. It is immediately sent to me.

I encourage you to drop me a note if you're so inclined, letting me know how you're enjoying this book, any problems you might have encountered, and any commands you were puzzled by that might be easier with a bit more explanation. If nothing else, just say hi!


  1. Although electronic mail addresses always follow the same format, they can vary quite a bit. To give you an idea of the variation, I used grep to extract the From: addresses of some mail I've recently received:

    % grep '^From:' /usr/spool/mail/taylor
    From: Steve Frampton <[email protected]>
    From: Joanna Tsang <[email protected]>
    From: "Debra Isserlis" <[email protected]>
    From: "Jay Munro [PC Mag]" <[email protected]>
    From: [email protected] (Linda Wei)
    From: Cheryl <[email protected]>
    From: [email protected] (Mickey Harris)
    From: [email protected]
    From: "ean houts" <[email protected]>
    From: [email protected] (Mickey Harris)
    From: "Barbara Maxwell" <[email protected]>
    From: [email protected] (Steve Mansour)
    From: [email protected] (Aditya Bhasin)
    From: [email protected]
    From: [email protected] (Marvin Raab)
    

    The notational convention for the From: line in electronic mail clearly varies. You see three basic notations in this line: just an address, such as the one from [email protected]; an address with the name in parentheses, such as the message from Linda Wei about one-third way down the list; and a line with the person's name followed by his or her email address in angle brackets, such as the first listed line.

    Notice the various sites from which I've received electronic mail in the past few days: SFSU.EDU is San Francisco State University, oracle.com is Oracle Corporation in California, PURDUE.EDU is Purdue University, CompuServe.COM is the CompuServe network, ccgate.infoworld.com is InfoWorld magazine's Macintosh network running Cc:Mail, xalt.com is from XALT Corporation, and kent.edu is Kent State University. The message from [email protected] is from an educational institution in The Netherlands!

Sending electronic mail back and forth with users throughout the world is one of the most exciting and fun parts of learning UNIX. I often read magazine articles, for example, in which the author lists an electronic mail address. It's a simple task to zip out a message if I have questions or kudos on the piece. Many magazines, from the Utne Reader to MacWorld, even list electronic mail addresses for the editorial staff. Even reporters from the Wall Street Journal and the New York Times are on the Internet.


Task 19.6: The Smarter Electronic Mail Alternative, elm

Just as line editors pale compared to screen editors such as vi, so does Berkeley Mail when compared to the Elm Mail System, or elm. Although the Elm Mail System is not available on all UNIX systems, it's widely distributed, and if you don't have it on your system, your system's vendor should be able to help out.


The basic premise of elm is that the user should be able to focus on the message, not the medium. Emphasis is placed on showing human information. The best way to show how it works is to go straight into it!

I'm probably just a bit biased about elm because I am the author of the program. The widespread acceptance of the design, however, suggests that I'm not alone in having sought a friendlier alternative to Berkeley Mail.

Another mailer with a very similar user interface is Pine. If you have access to both Elm and Pine, however, I recommend that you pick Elm because it lets you work with your mail in a much more efficient manner.


  1. To start the Elm Mail System, enter elm:

    % elm
    							

    The screen clears and is replaced with this:

    Mailbox is '/usr/spool/mail/taylor' with 15 messages [ELM 2.3 PL11]
    
    
     --> 1   Dec 8  v892127@nooteboom. (52)   Re: Have you picked up the com
         2   Dec 7  Mickey Harris      (214)  Various writing environments
         3   Dec 7  Cheryl             (24)   Computer Based GRE's
         4   Dec 7  Mickey Harris      (69)   Re: Writing Lab OWL project
         5   Dec 7  Russell Holt       (37)   flash cards
         6   Dec 7  Bill McInerney     (121)  New Additions to U.S. Dept
         7   Dec 5  Mickey Harris      (29)   Re: OWL non-stuff
         8   Dec 5  Rob Sartin         (31)   I need your address
         9   Dec 4  J=TAYLOR@MA@168ARG (28)   Note to say HI!
      OU 10  Dec 3  Linda Wei          (143)  Re: Attachments to XALT
    
    
       You can use any of the following commands by pressing the first char
     d)elete or u)ndelete mail, m)ail a message, r)eply or f)orward, q)uit
        To read a message, press <return>.  j=move down, k=move up, ?=help
    
    Command: -
    

    The current message is indicated by the arrow (or, on some screens, the entire message line appears in inverse video). Whenever possible, elm shows the name of the person who sent the message (for example, Mickey Harris rather than mharris as in Berkeley Mail), indicates the number of lines in the message (in parentheses), and shows the subject of the message.

    The last few lines on the screen indicate the options available at this point. Notice that j and k move the cursor up and down the list, just as they move up and down lines in vi.

  2. To read a message, use the j key to zip down to the appropriate message and press Return. You then will see this:

    Message 3/15  From Cheryl                      Dec 7 '98 at 4:57 pm
    est
                                  Computer Based GRE's
    
    
    I've scheduled to take the computer based GRE's in Indy on Jan. 6th.
    Call me crazy but someone's got to do it.  I'll let you know how it
    goes.
    
    Do you know anyone else that has taken the GRE's this way?  I figure
    there's a paper in it somewhere.....
    
    If you have that handout from seminar in a file, could you please
    send it to me?
    
    Thanks.
    
    
    
    
    
    
    
    Command ('i' to return to index): -
    

    At this point, you can use j to read the next message directly, r to reply, or i to return to the table of contents.

  3. I realized that I said something in my message to Cheryl that was incorrect. I can type r here to reply to her message. Typing r causes the last few lines of the screen to be replaced with this:

    ---------------------------------------------------------------------
    ---
    Command: Reply to message                          Copy message?
    (y/n) n
    							

    To include the text of the message in your response, type y. I don't want to, so I press Return:

    ---------------------------------------------------------------------
    ---
    Command: Reply to message     To: CBUTCHER (Cheryl)
    Subject of message: Re: Computer Based GRE's-
    

    Now you can see the address to which the response will be sent, the name of the recipient (in parentheses), and the subject of the message. (elm automatically adds the Re prefix to the subject.) The cursor sits at the end of the subject line so that you can change the subject if you want. It's fine, so I again press Return:

    ---------------------------------------------------------------------
    ---
    Command: Reply to message     To: CBUTCHER(Cheryl)
    Subject of message: Re: Computer Based GRE's
    Copies To: -
    

    No copies are needed, so I again press Return. The bottom of the screen now looks like this:

    ---------------------------------------------------------------------
    ---
    Command: Reply to message     To: CBUTCHER(Cheryl)
    Subject of message: Re: Computer Based GRE's
    Copies to:
    
    Enter message.  Type Elm commands on lines by themselves.
    Commands include:  ^D or '.' to end, ~p to list, ~? for help.
    
    -
    

    Notice that ~p and ~? are available. In fact, all the tilde commands available in Berkeley Mail also are available in the Elm Mail System.

    I enter the message and end with a .:

    								Just a reminder that we have that seminar tomorrow
    								afternoon too. See ya there?   -- Dave
    .
    

    Ending the message calls up this:

    Please choose one of the following options by parenthesized letter: s
                 e)dit message, edit h)eaders, s)end it, or f)orget it.
    

    I press Return once more, and the message is sent.

  4. I type i to return to the index page and q to quit.

There's a lot more the Elm Mail System can do to simplify your electronic mail interaction. If elm is available on your system, I encourage you to check it out further, and if it's not, try calling your vendor or a user group to see whether someone else can arrange for you to have a copy. Like the Free Software Foundation applications, elm is free. With it you even get the source so that you can see how things are done internally if you're so inclined.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.136.170