write user_name [terminal]
write lets you send a message directly to the terminal of someone else logged in to the system. It reads from the standard input (stdin) and writes to the terminal of another user.
Message from your_name (terminal) [date] …
After the system establishes the connection to the other user, it sends two alert characters (typically beeps) to your terminal to tell you that it is ready to send your message. You can then type your message, which will appear on the other user's terminal. To end your message, enter end-of-file or an interrupt (typically, <EscChar-D> for end-of-file or <EscChar-C> for an interrupt, where EscChar is normally the cent sign; if you use rlogin or telnet to enter the shell, you hold down the Ctrl key while you press either D or C). When write receives an indication for end-of-message, it tells the other user that the message is over and breaks the connection.
write your_user_name
However, if both of you are trying to write on each other's terminal at the same time, the messages may get interleaved on your screens, making them difficult to read. For two-way conversations, use talk instead of write.
Here is what my file contains:
!cat file
mesg n
you can tell the system that
you don't want to be interrupted by write messages.
If people try to write to you, they are
denied immediately; the system does not inform you about such attempts.
For further details, see mesg.See Localization for more information.
POSIX.2 User Portability Extension, X/Open Portability Guide, UNIX systems.
mailx, mesg, talk, who