ARCHIVED: In Unix, how do I send a brief interactive message to someone?

This content has been archived, and is no longer maintained by Indiana University. Resources linked from this page may no longer be available or reliable.

Using the msg command

On some Unix computers, you can send a quick message using the msg command. To send a message, enter:

  msg username@host 
  This is the message being sent

Replace username@host with the address of the person to which you want to send the message, and This is the message being sent with your message.

For example, to send the message "Hey Darth, do you have my printouts?" to the user, at the Unix prompt, enter:

  Hey Darth, do you have my printouts?

The following message will appear on your recipient's screen:

  yourname@yourhost.yourdomain:   Hey Darth, do you have my printouts?

Your address would replace yourname@yourhost.yourdomain.

Some Unix computers cannot receive msg messages. At Indiana University, most UITS hosts are not configured to do so. Also, msg is not installed on some hosts, and you may need to use the write command instead.

Using the write command

You can also use the write command to send a message. This command can send several lines of text to another user logged into the same Unix computer. Here is an example of the write command:

  write fred
  Hey fred!
  Did you bring your homework with you?

The ^D stands for Ctrl-d. Press this to end the write message.

Below is a sample of the output of write:

  Message from yourname@yourhost.yourdomain on ttyr2 at 14:13 ...
  I don't have my homework with me
  My dog ate it

EOF stands for "End Of File" and signifies the end of the message being sent.

Turning messages on and off

The msg and write commands won't work if a user is refusing messages. The mesg command will turn on or off the ability to receive messages. To turn on messages, enter:

  mesg y

To turn off messages, enter:

  mesg n

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

This is document acjl in the Knowledge Base.
Last modified on 2018-01-18 09:24:52.

Contact us

For help or to comment, email the UITS Support Center.