I know you can use write to send a message to a currently logged in user, but how do you leave a message for a user who is not logged in? The solution I have seen is modify the motd, but that will be displayed to all users. How can I leave a message for individual users to read when they login?

2 Answers 2


You can use the mail command to send a message to user jdoe like this:

mail -s "The subject goes here" jdoe

You will enter an interactive environment where you can type your message (mail body). Type Control-D in the beginning of a line to end the message and send it (you will be asked for an optional CC recipient - just hit enter if you don't want one).

You can also do:

mail -s "The subject goes here" jdoe < textfile


echo "John, please don't forget our meeting" | mail -s "Reminder" jdoe

The next time jdoe logs in, he will receive a notification like "You have new mail" and he must type mail to read it (perhaps this is a drawback if the user doesn't know he must do this).

  • This is exactly what I was looking for! Now is there a way to show how many new messages there are without opening mail? I'm reading the man page and I don't see a way to do that. I also can't make a bash script that pushes 'q' for me as far as I know.
    – styfle
    Commented Sep 24, 2011 at 4:30
  • I noticed that when I login, it says 'You have mail' so that is already solved. But in case anyone is wondering, you can use a script like echo "q" | mail to see how many messages you have.
    – styfle
    Commented Sep 24, 2011 at 5:13
  • Note that the mentioned notification is issued by the shell and can be turned off. Supposing you use Bash, see MAIL, MAILCHECK and MAILPATH in the man to know what you can expect.
    – manatwork
    Commented Sep 24, 2011 at 11:08
  • 1
    You can also run biff to monitor the mailbox. Commented Sep 25, 2011 at 0:56
  • this didn't work. I sent a mail to a local user and logged in to that user but didn't receive any mail.
    – Necktwi
    Commented Jul 8, 2017 at 7:33

Try wall, http://linux.die.net/man/1/wall Maybe that will do the trick?

  • 5
    This is pretty much the opposite of what he wants. He wants a command that leaves a message for a specific, logged out user; wall shows a message to all users currently logged in Commented Jul 1, 2012 at 1:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .