Users can disallow anyone to send them messages via the mesg utility. Therefore, before you start attempting to send messages, it’s a good idea to check whether messages are allowed. For yourself, you can simply enter the mesg command as follows:
$ mesg is n $
The “is n” result shows that messaging is turned off. If the result showed “is y”, messages would be allowed.
If you don’t want to receive any messages from other users, use the mesg command. This command works with two arguments only. mesg n makes sure that no one can write messages to your console. If you want to open your console again for messages from other users, use mesg y.
mesg Command Examples
1. To allow write access to your terminal:
# mesg y
2. To disallow write access to your terminal:
# mesg n
Final Thoughts
mesg with argument -n forbids messages via write(1) by revoking nonuser write permission on the user’s terminal. mesg with argument -y reinstates permission. All by itself, mesg reports the current state without changing it.