write - Linux


The write command in Linux is used for sending a message to another user logged into a Unix system. This command allows a user to communicate interactively by sending text directly to another user’s terminal. write is most effective for quick, direct communication between system users on the same machine.


The basic syntax of the write command is:

write user [tty]
  • user: Specify the login name of the user you want to send the message to.
  • tty: Optional. Specify the terminal device if the user is logged in more than once.

To end the message, type Ctrl-D to signify the end of the transmission.


The write command has no options or flags. Its functionality is straightforward and does not require additional parameters beyond the recipient’s username and optionally, their tty device.


  1. Basic Usage:
    Send a message to user john:

    write john
    Hello John, can we meet at 3 PM today?
    # Press Ctrl-D to end the message
  2. Specifying a tty Device:
    If John is logged in multiple sessions, specify which terminal to send the message to:

    write john pts/2
    Reminder: Meeting at 3 PM in conference room B.
    # Press Ctrl-D to end the message

Common Issues

  • User not logged in: If the user is not logged in, you will receive an error message: “write: user-name is not logged in”. Make sure the user is logged in before sending a message.

  • Permission Issues: Users can prevent message receipts by using the mesg n command. If you cannot send a message, it’s possible the recipient has disabled messaging.

  • Confusion over multiple sessions: If the user is logged in multiple times, the message might go to an unintended terminal. Specify the correct tty device to ensure the message is seen.


write can be combined with other commands for various tasks. For instance, to send the output of date command to a user:

date | write john

You can also use it in scripts to notify users of system events or task completions.

  • mesg: Enable or disable write access to your terminal.
  • wall: Send a message to all users.
  • talk: Similar to write, but allows for a conversation between two users.
  • who: Display who is logged on which can be used to find out user’s tty.

Further reading and resources can be found in the manual pages (man write), or the documentation hosted on GNU’s website.