Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

mesg - permit or deny messages

&pagelevel(4)&pagelevel

mesg controls the receival of messages on terminals that have logged on to POSIX with rlogin or telnet. You can use mesg to check whether your terminal can receive messages or to grant or deny other users the permission to send messages to your terminal with write.


Syntax


mesg[ y| n]

No option specified

mesg reports the current setting for your terminal and returns an exit status of 0 if messages may be sent to it, or 1 if they cannot.

option

y

Grants other users permission to write messages to your terminal.

This corresponds to the old argument -y which is still supported.

n

Denies other users permission to write messages to your terminal. Messages sent via wall or write by the POSIX administrator override this denial.

This corresponds to the old argument -n which is still supported.

Exit status

0Messages are receivable
1Messages are not receivable
>1Error

File

/dev/tty* and /dev/term/tty*

Files containing terminal-specific information.

Locale

The following environment variables affect the execution of mesg:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL

If set to a non-empty string value, override the values of all the other internationalization variables.

LC_CTYPE

Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other.

LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

Example 1

User heidi, who is logged in at terminal tty001, checks the current setting for this terminal:

$ mesg

is n

Messages are not receivable at terminal tty001. Thus no messages can be sent to heidi while she is working at terminal tty001:

$ write heidi

Permission denied.

Example 2

heidi can change the setting at terminal tty01 by entering:
$ mesg y

See also

tty, write, wall