Cover V03, I01
Figure 1
Sidebar 1
Sidebar 2
Sidebar 3


Communicating without E-Mail

Emmett Dulaney

Electronic mail is the primary means by which users can communicate with each other -- whether within the same system, across a network, or, if they're connected to a service such as the Internet, anywhere in the world. While this is an important tool, there are other ways in which one user -- specifically, for our purposes, a system administrator -- can communicate with another user or users.

This article covers the alternatives to e-mail. While some of the methods are useful only under specific conditions, most can be implemented on any UNIX operating system.

Write and Talk

The simplest means of sending a message to another user currently on the system is with the write command. Use who to find out if the intended recipient is on the system (unlike mail, write restricts communication to users currently logged on) and then summon write. Following is an example:

$ who
emmett     ttya         Nov 27 06:35
root       ttyb         Oct 31 19:24

$ write karen
karen is not logged on.

$ write root

At this point, the other user's terminal beeps twice and displays the message

Message from {you} on {node name} {terminal} [ {date} ] ...

such that they now see

Message from emmett on ALDEN (ttya) [ Tue Dec 12 06:41:53 ] ...

At this point the prompt has disappeared from both terminals. As you type your message, the write utility copies the line from your terminal to the terminal of the other user every time you press the Return key.

If the other user presses Return the prompt reappears. To respond to your message, the user must invoke:

write {your name}

Communication then continues, from one terminal to another, until you press Control-D. At that point, your prompt returns, and the other user's screen displays EOT, indicating the end of the transmission.

If a user is logged into the system more than once, or if more than one user is using the same login (a horrible idea to the security-conscious), then you must further identify the user by adding terminal information to the user name. In the following example session, two users are logged in as root:

$ who
emmett     ttya         Nov 27 06:35
root       ttyb         Oct 31 19:24
root       ttyv008      Nov 27 05:19

$ write root
root is logged on more than one place.
You are connected to "ttyb".
Other locations are:

If you do not specify the terminal, the write utility uses the first occurrence of the designated user in the /etc/utmp file.

To clearly specify which user you want to speak with when more than one is present, give the terminal location as well:

$ write root ttyb

The finger command can help you figure out which of the multiple users is the one you intend to write to, but for the most part, it is up to you to know which terminal a user predominantly uses.

talk an interactive form of write, exists in many versions of UNIX -- particularly Berkeley. When invoked, it tells the other user that you're trying to get in touch. It continuously retries, sending a message approximately every two minutes, unless interrupted by you. The user you're calling can respond by invoking talk and specifying your username.

In a talk session, the screen on both terminals is divided, with a dashed line in the middle. What each user types appears on the top half of his/her screen, while what the other is typing appears on the bottom half. After the session has been established, if either user exits, the session is terminated on both ends.

talk examines the status of the mesg flag (discussed below) to determine whether or not to allow operation, and responds with "Permission denied" if the flag is set to n.

If a network is present, you can write or talk to a user on a system other than the one you are on by specifying the user and machine name, separated by "@". For example, to write to "karen" on the "SCOTT" system, the syntax is:

$ write karen@SCOTT

Denying write and talk With mesg

mesg is used to permit or deny messages. To prevent other users from writing messages to you, use mesg n. If you use mesg without a parameter, the response is the status of the mesg flag:

$ mesg
is y

The n argument revokes non-user write permission on the user's terminal. The y argument reinstates the permission.

If you've set mesg to n, the person trying to write to you receives a message informing them that permission has been denied.

Setting mesg to n also prevents a user to whom you've written from responding. In this case you'll receive an error message: "Warning: cannot respond, set mesg y." To correct this, set mesg to y. If you are already in the write mode, precede the message with an exclamation mark to invoke the shell, !mesg y.

The other error message you mght see -- "Can no longer write to user" -- indicates that the other user had been accepting messages, but since your initial message, has denied permission (mesg n).

Only root, the superuser, can send messages to a user whether or not the message flag is on. For all other users, the message flag is examined before messages are accepted.

news and /etc/motd

To send a message to everyone, you can use wall (see the sidebar, "Using Wall"), but the message will only go to users who are currently logged on. You could use mail, but this would cause each person's mail file to grow with each message.

A better alternative is to use news, which creates one file that all users on the system read. If the news command is in a user's login routine, when the user logs in the contents of any files in /usr/news, or /var/news (depending upon the vendor) will be displayed. Once the file has displayed, the user's name is removed from the list of users who need to see it, and the file is not shown to them again, regardless of how many times they subsequently log in.

If the user presses Delete while a news item is being shown, the display stops and the next item is started. Another Delete within one second of the first terminates news.

Invoked without any options, news prints the current items. Other options that can be used are:

-a -- Display all items regardless of whether or not they've already been viewed.

-n -- Show only the names of the current files.

-s -- Show only a count of how many current files exist.

To keep the file from growing too large, the system administrator should occasionally go through it and parse old entries of a month or so in age.

The news utility essentially displays a message only once to each user. Some messages, however, should be displayed at every login. UNIX accomplishes this by means of /etc/motd file. The contents of this ASCII file are displayed at the conclusion of each successful login, before the appearance of the prompt.

Other Means

motd displays messages immediately after the successful login: to display information before login, you can use issue. Many systems incorporate an /etc/issue file that contains the issue -- or project -- identification printed as a login prompt. It is a standard ASCII file read by getty and then written to all terminals spawned or respawned by the /etc/inittab file. If there is no /etc/issue file, the login prompt is the node name and the word login. The file can hold any information, and its contents will appear between the node name and prompt, as, for example, in Figure 1.

Practical uses for this file include storing messages such as "System going down at 10:00, do not login past 09:30," or "Scan all disks for viruses."

One last means of writing to a user (or more specifically, a terminal), regardless of the message flag status, is with the echo command and a bit of redirection. This method requires that, you know which terminal the user is using and how to address it. who can show you where the user is, and tty will give the full address.

Given the complete address, you can send a message in the following format:

$ echo Your message > /dev/devID

In addition to straightforward echoing, you can embed escape conventions in the message, including:

\07 -- beep

\b -- backspace

\f -- form-feed

\n -- new-line

\r -- carriage return

\t -- tab

You can use single quotation marks to send the output of executed commands to the another screen. For example:

$ echo `clear` > /dev/ttya

clears the receiving screen (device ttya), while:

$ echo `date` > /dev/ttya

sends today's date and time to the screen. You can also send contents of a memo file, but keep in mind that echo views the entire file as a command, and does not see the carriage returns.

To alleviate this problem, when you create the memo file, add the new line characters directly in the text. echo will then interpret them when it sends the file to the terminal.


There are seven ways to communicate with users currently logged on, or with users when they log on to the system: write, talk, news, the issue and motd files, echo, and wall. Using these files and utilities, you can relay messages relevant to system status, or pass along other pertinent information.

About the Author

Emmett Dulaney has been working with UNIX for more years than he cares to remember. The author of several books, including UNIX Unleashed!, he also teaches a UNIX continuing education class at Indiana-Purdue University of Fort Wayne.