Fun with Unix: Writing Messages

This is the first in a mini-series of articles about using Linux/Unix to do things other than view logs and edit files. I’m 26 and find that many of my peers weren’t exposed to Unix servers at university, so they miss out on this. If you have any suggestions of things to include in the mini series, let me know please!

Write messages

So to pop up a message on another user’s PC, you’d usually use MSN, right? Well if you’re both logged into the same server there is another way. Just echo your message and then send the program write to get it to the person. Like this:

echo “Hello Kevin” | write kevin

Kevin will get a message on his screen which says:


Message from lorna@server on pts/1 at 22:14 ...
Hello Kevin
EOF

Silence please

To turn off receiving messages, you need to change your mesg setting, by setting it to n:

mesg n

Not surprisingly, you can turn it back on with:

mesg y

That’s today’s installment, have fun!

2 thoughts on “Fun with Unix: Writing Messages

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.