In Linux, the mesg command is used to control the message display function on the terminal or pts, allowing users to set whether to accept messages sent to them by other users. There are two main options: 1. "mesg y", Indicates that other users are allowed to send messages to this machine; 2. "mesg n" means that other users are prohibited from sending messages to this machine.
The operating system of this tutorial: Linux5.18.14 system, Dell G3 computer.
In Linux, the mesg command is used to control the message display function on the terminal or pts. It allows users to set whether to accept messages sent to them by other users.
mesg command has two main options:
mesg y: This option allows other users to send you messages. After you use the mesg y command, other users can use the write command to send you messages, and you will receive corresponding prompts.
mesg n: This option means to prohibit other users from sending you messages. After you use the mesg n command, other users will not be able to use the write command to send you messages.
Normally, the newly created terminal or pts will enable the mesg function by default, allowing other users to send messages. However, if you wish to temporarily turn off message reception, you can use the mesg n command. Likewise, if you wish to re-enable message reception, you can use the mesg y command.
It should be noted that the mesg command only applies to terminals or pts sessions, not network connections or remote terminals. Additionally, the mesg command may be restricted by system administrator settings, so some users may not be able to change their message receiving settings.
The above is the detailed content of What is the function of mesg command in linux. For more information, please follow other related articles on the PHP Chinese website!