Skip to content

Linux mesg command

The Linux mesg command is used to control whether other users can send messages to your terminal. It changes the permission for users to write to your terminal. By default, users are allowed to send messages to your terminal. Using mesg, you can enable or disable this feature. When mesg is used without any arguments, it displays the current message permission status. By specifying + or - along with mesg, you can allow or disallow other users to send messages. This command is particularly useful when you want to avoid being interrupted by messages from other users on the system.

Terminal window
mesg [y|n]
OptionDescription
yAllow messages to be received
nBlock messages from being received
ParameterDescription
yAllow messages to be received
nBlock messages from being received
Terminal window
mesg y

This command enables messages from other users on the system.

Terminal window
mesg n

By running this command, you can disable message reception from other users on the system.

Terminal window
mesg

Running this command without any options displays the current message status for the user.

Terminal window
mesg y username

Using this command allows messages from a specific user to be received by the current user.

To use the mesg command in Linux, execute the following command:

Terminal window
mesg +y

What is the purpose of the mesg command in Linux?

Section titled “What is the purpose of the mesg command in Linux?”

The mesg command is used to control whether messages can be received on your terminal.

How can I prevent other users from sending messages to my terminal using mesg?

Section titled “How can I prevent other users from sending messages to my terminal using mesg?”

You can prevent other users from sending messages to your terminal by executing the following command:

Terminal window
mesg -n

How can I allow other users to send messages to my terminal using mesg?

Section titled “How can I allow other users to send messages to my terminal using mesg?”

To allow other users to send messages to your terminal, use the following command:

Terminal window
mesg +y

How can I check the current mesg status in Linux?

Section titled “How can I check the current mesg status in Linux?”

You can check the current mesg status by running the following command:

Terminal window
mesg

Can I use mesg to enable message receiving temporarily?

Section titled “Can I use mesg to enable message receiving temporarily?”

Yes, you can temporarily enable message receiving by executing the following command:

Terminal window
mesg -y

How do I enable message receiving permanently on my terminal using mesg?

Section titled “How do I enable message receiving permanently on my terminal using mesg?”

To enable message receiving permanently on your terminal, use the following command:

Terminal window
chmod u+s /usr/bin/mesg
  • Allow or deny messages from other users
  • Control access to your terminal