[Previous] [Contents] [Next]


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


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


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.
The user to write a message to.
The terminal to write a message to.


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.


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:

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:

Successful completion.
An error occurred.

See also:

wall, who

[Previous] [Contents] [Next]