WRITE(1)

NAME
write - write a message to another user

SYNOPSIS
write username [ ttyname ]

DESCRIPTION

write copies lines from your standard input to username's screen.

When you type a write command, the person you are writing to sees a message like this:

    Message from hostname!yourname on yourttyname at hh:mm ...

After typing the write command, enter the text of your message. What you type appears line-by-line on the other user's screen. Conclude by typing an EOF indication (CTRL-D) or an interrupt. At this point write displays EOF on your recipient's screen and exits.

To write to a user who is logged in more than once, use the ttyname argument to indicate the appropriate terminal name.

You can grant or deny other users permission to write to you by using the mesg command (default allows writing). Certain commands, nroff(1) and pr(1V) in particular, do not allow anyone to write to you while you are using them in order to prevent messy output.

If write finds the character `!' at the beginning of a line, it calls the shell to execute the rest of the line as a command.

Two people can carry on a conversation by “writing” to each other. When the other person receives the message indicating you are writing to him, he can then write back to you if he wishes. However, since you are now simultaneously typing and receiving messages, you end up with garbage on your screen unless you work out some sort of scheduling scheme with your partner. You might try the following conventional protocol: when you first write to another user, wait for him to write back before starting to send. Each person should end each message with a distinctive signal — -o- (for “over”) is standard — so that the other knows when to begin a reply. To end your conversation, type -oo- (for “over and out”) before finishing the conversation.

EXAMPLE

Here is an example of a short dialog between two people on different terminals. Two users called “Horace” and “Eudora” are logged in on a system called “jones”. To illustrate the process, both users' screens are shown side-by-side:
Eudora's Terminal	Horace's Terminal
	Horace is staring at his screen
jones% write  horace
how about a squash game tonight? -o-
	Message from jones!eudora on tty09 at 17:05 ...
	how about a squash game tonight? -o-
	jones% write  eudora
	I'm playing tiddlywinks with Carmeline -o-
Message from jones!horace on tty03 at 17:06 ...
I'm playing tiddlywinks with Carmeline -o-
How about the beach on Sunday? -o-
	How about the beach on Sunday? -o-
	Sorry, I'm washing my tent that day -o-
Sorry, I'm washing my tent that day -o-
See you when I get back from Peru -oo-
	See you when I get back from Peru -oo-
^D
jones%	EOF
	I hear rack of llama is very tasty -oo-
	^D
I hear rack of llama is very tasty -oo-
EOF	jones%

ENVIRONMENT

The environment variables LC_CTYPE, LANG, and LC_default control the character classification throughout write. On entry to write, these environment variables are checked in the following order: LC_CTYPE, LANG, and LC_default. When a valid value is found, remaining environment variables for character classification are ignored. For example, a new setting for LANG does not override the current valid character classification rules of LC_CTYPE. When none of the values is valid, the shell character classification defaults to the POSIX.1 “C” locale.

FILES
/etc/utmp
    to find user
/usr/bin/sh
    to execute !

SEE ALSO
mail(1), mesg(1), pr(1V), talk(1), troff(1), who(1), locale(5)