[Previous] [Contents] [Next]

write

Write a message to a user's terminal (POSIX)

Syntax:

write [-l] [-n node] username [terminal]

Options:

-l
Locate the user and report active sessions (tty name and idle time) to stdout. (Does not write a message to the user.)
-n node
Search only the specified node for username.
username
The user to write a message to.
terminal
The terminal to write a message to.

Description:

You use the write utility to send a message to the terminal or console of another user.

When you invoke write, it writes the message:

Message from sender (sending-terminal) [date]

to the recipient's terminal. Then it copies its standard input to the recipient's terminal on a line-by-line basis until you type Ctrl-D.

The recipient can reply  -- thus engaging you in an interactive conversation  -- by entering:

write sender sending-terminal

If the first input character typed on a line is the exclamation mark (!), the write utility will pass the remainder of the line to the Shell (normally sh) for execution.

You can't send nonprintable characters through the write utility. They'll be expanded to octal before being written to the recipient's terminal.

When writing to a user who is logged in more than once, write will select one of the terminals to write to. You can use the terminal argument to force write to write to a particular terminal.

Examples:

Write to user eric on the local node:

    write -n 0 eric

Search the network for the user dtdodge and write to his terminal or console:

    write dtdodge

Write to aboyd on node 10:

    write -n 10 aboyd

Write to steve on //60/dev/ser1:

    write steve //60/dev/ser1

Environment variables:

SHELL
Used to determine the preferred command-line interpreter for use in command escapes. If no SHELL environment variable is set, the sh utility will be used.

Exit status:

0
Successful completion.
>0
An error occurred.

See also:

wall, who


[Previous] [Contents] [Next]