Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > W


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


write — interactively write (talk) to another user


write user [terminal]


The write command copies lines from your terminal to that of another user. When first called, it sends the message:

  • Message from yourname (yourterminal ) [ date ] ...

to the receiving user's terminal. When it has successfully completed the connection, it also sends two bells to your own terminal to indicate that what you are typing is being sent.

To set up two-way communication, the recipient of the message (user) must execute the command:

write yourname [yourterminal]

(yourterminal is only required if the originator is logged in more than once.)

Communication continues until an end of file is read from the terminal, an interrupt is sent, or the recipient executes mesg n. At that point, write writes <EOT> on the other terminal and exits.

To write to a user who is logged in more than once, use the terminal argument to indicate which line or terminal to send to (e.g., tty00). Otherwise, the first writable instance of the user found in utmps database is assumed and the following message is displayed:

user is logged on more than one place. You are connected to "terminal". Other locations are: terminal ...

Permission to write may be denied or granted with the mesg command (see mesg(1)). Writing to others is normally allowed by default. Certain commands, in particular nroff and pr disallow messages in order to prevent interference with their output. However, if the user has the appropriate privileges, messages can be forced onto a write-inhibited terminal.

If the character ! is found at the beginning of a line, write calls the POSIX shell (see sh-posix(1)) to execute the rest of the line as a command.

The following protocol is suggested for using write: When you first write to another user, wait for the user to write back before starting to send. Each person should end a message with a distinctive signal (such as "(o) " for "over") so that the other person knows when to reply. Similarly, the signal "(oo) " (for "over and out") can be used to indicate the end of the conversation.


Environment Variables

LANG determines the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_) do not specify a locale. If LANG is not set or is set to the empty string, a default of "C" (see lang(5)) is used.

LC_TIME determines the format and contents of date and time strings.

LC_MESSAGES determines the language in which messages are displayed.

If any internationalization variable contains an invalid setting, write behaves as if all internationalization variables are set to "C". See environ(5).

International Code Set Support

Single- and multi-byte character code sets are supported.


user is not logged on.

The user you are trying to write to is not logged on.

Can no longer write to terminal

Your correspondent has denied write permission (mesg n) after your write session started. Your write session is ended.


Your correspondent sent end-of-file, or you set your terminal to mesg n and your correspondent tried to write to you. If you have a write session established, you can continue to write to your correspondent.

Permission denied.

The user you are trying to write to has denied write permission (with mesg n).

Warning: You have your terminal set to "mesg -n". No reply possible.

Your terminal is set to mesg n and the recipient cannot respond to you.


By issuing the command:

write matthew

user linda sends a message to user matthew's screen. If matthew responds:

write linda

two-way communication between matthew and linda is established.


utmps database

To find user


To execute ! shell commands


write: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.