MESG(1)

๐Ÿ’ฌ MESG(1) โ€” the "do I want randos typing at my terminal" command ๐Ÿ’ฌ

okay bestie, pull up a chair, because this is mesg, a lil User Command from the util-linux girlies, and honestly? she's been around forever and she still eats. ๐Ÿ“


โœจ NAME โœจ

mesg โ€” display (or do not display) messages from other users


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

mesg [option] [n|y]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so basically, you run mesg to control the write access that other people have to the terminal device tied to your standard error output. and if write access is allowed? then programs like talk(1) and write(1) can just... pop messages onto your terminal. mid-vim-session. no warning. iconic behaviour honestly. ๐Ÿ˜ญ

traditionally, write access is allowed by default. but bestie, the times have changed โ€” as users become more conscious of various security risks, there's a whole trend of removing write access by default, at least for the primary login shell. and like, valid.

the initial permissions for your terminal are set by login(1) according to TTYPERM and TTYGROUP from /etc/login.defs. the default is mode 0620 if a tty group is used, and 0600 without the group. and the default tty group name is "tty". noted. ๐Ÿ“

to ensure that your ttys are set in a portable and independent manner from system settings, mesg should be executed in your login scripts. fr fr, do it.

mesg modifies the write permissions for a group on the current terminal device. and here's the tea ๐Ÿซ–: since version 2.41, mesg can no longer be compiled to make the terminal writable for others and strictly modifies only group permissions. the usual setup is to use a "tty" group and add relevant users to this group. alternatively, a less secure solution is to set utilities like write(1) or wall(1) to setgid for the "tty" group. (yes, we said "less secure." that's a warning, babe.)

and this next part is important: the mesg utility silently exits with error status 2 if not executed on a terminal. in this case executing mesg is pointless. like, there's literally nothing to do. the command line option --verbose forces mesg to print a warning in this situation. this behaviour has been introduced in version 2.33. the lore goes deep. ๐Ÿ“œ


๐ŸŒธ ARGUMENTS ๐ŸŒธ

  • n โ€” Disallow messages. (blocked. do not perceive me. ๐Ÿ’…)
  • y โ€” Allow messages to be displayed. (open for business โœจ)

if no arguments are given, mesg shows the current message status on standard error output. just a lil vibe check on your current setup.


๐Ÿ’… OPTIONS ๐Ÿ’…

  • -v, --verbose โ€” Explain what is being done. she's narrating her own life.
  • -h, --help โ€” Display help text and exit. ๐Ÿซถ
  • -V, --version โ€” Display version and exit. ๐Ÿ‘‘

โญ EXIT STATUS โญ

the mesg utility exits with one of the following values:

  • 0 โ€” Messages are allowed. ๐Ÿ’–
  • 1 โ€” Messages are not allowed. ๐Ÿ™ˆ
  • >1 โ€” An error has occurred. ๐Ÿ’€

๐ŸŽ€ FILES ๐ŸŽ€

/dev/[pt]ty*, /dev/pts/[0-9]*

๐ŸŒˆ HISTORY ๐ŸŒˆ

mesg (I) appears in the UNIX Programmer's Manual. and get this โ€” it used to invert the current state with no argument before Version 7 AT&T UNIX. so running it bare just flipped the switch. chaotic. we love a glow-up. โœจ


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

login(1), talk(1), write(1), wall(1), xterm(1)


๐Ÿ› REPORTING BUGS ๐Ÿ›

found a bug? for bug reports, use the issue tracker:

https://github.com/util-linux/util-linux/issues

๐Ÿ’œ AVAILABILITY ๐Ÿ’œ

the mesg command is part of the util-linux package which can be downloaded from Linux Kernel Archive:

https://www.kernel.org/pub/linux/utils/util-linux/

and that's the whole page, bestie!! ๐Ÿงš this one is util-linux 2.42.4, dated 2026-09-21 โ€” go forth and control your terminal permissions, main character. periodt. ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐ŸŒธ๐Ÿ’…๐Ÿซถ

๐Ÿ“ฆ where this page comes from
  • arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms