{
    "mode": "man",
    "parameter": "MESG",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/MESG/1/json",
    "generated": "2026-09-20T04:29:14Z",
    "synopsis": "mesg [option] [n|y]",
    "sections": {
        "NAME": {
            "content": "mesg - display (or do not display) messages from other users\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "mesg [option] [n|y]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The mesg utility is invoked by a user to control write access others have to the terminal\ndevice associated with standard error output. If write access is allowed, then programs such\nas talk(1) and write(1) may display messages on the terminal.\n\nTraditionally, write access is allowed by default. However, as users become more conscious of\nvarious security risks, there is a trend to remove write access by default, at least for the\nprimary login shell. To make sure your ttys are set the way you want them to be set, mesg\nshould be executed in your login scripts.\n\nThe mesg utility silently exits with error status 2 if not executed on a terminal. In this\ncase executing mesg is pointless. The command line option --verbose forces mesg to print a\nwarning in this situation. This behaviour has been introduced in version 2.33.\n",
            "subsections": []
        },
        "ARGUMENTS": {
            "content": "n\nDisallow messages.\n\ny\nAllow messages to be displayed.\n\nIf no arguments are given, mesg shows the current message status on standard error output.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-v --verbose",
                    "content": "Explain what is being done.\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-h --help",
                    "content": "Display help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-V --version",
                    "content": "Print version and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "The mesg utility exits with one of the following values:\n\n0\nMessages are allowed.\n\n1\nMessages are not allowed.\n\n>1\nAn error has occurred.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/dev/[pt]ty*, /dev/pts/[0-9]*\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "mesg (I) appears in the UNIX Programmer’s Manual. It used to invert the current state with no\nargument before Version 7 AT&T UNIX.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "login(1), talk(1), write(1), wall(1), xterm(1)\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at \u001b[34mhttps://github.com/util-linux/util-linux/issues\u001b[0m.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The mesg command is part of the util-linux package which can be downloaded from \u001b[34mLinux Kernel\u001b[0m\n\u001b[34mArchive \u001b[0m<https://www.kernel.org/pub/linux/utils/util-linux/>.\n\nutil-linux 2.39.3                            2023-11-21                                      MESG(1)",
            "subsections": []
        }
    },
    "summary": "mesg - display (or do not display) messages from other users",
    "flags": [
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "Explain what is being done."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Print version and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "login",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/login/1/json"
        },
        {
            "name": "talk",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/talk/1/json"
        },
        {
            "name": "write",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/write/1/json"
        },
        {
            "name": "wall",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/wall/1/json"
        },
        {
            "name": "xterm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/xterm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Check or set a terminal's ability to receive messages from other users, usually from the `write` command.",
        "examples": [
            {
                "description": "Check terminal's openness to write messages",
                "command": "mesg"
            },
            {
                "description": "Disallow receiving messages from the write command",
                "command": "mesg n"
            },
            {
                "description": "Allow receiving messages from the write command",
                "command": "mesg y"
            }
        ]
    }
}