Administration
mesg
Control whether other users can write to your terminal.
terminalwritemessagepermissiontalk
Additional Notes
mesg controls write access to the current terminal. When enabled, other users can send messages to your terminal using the write command or similar tools. When disabled, messages are rejected.
It reads or sets the write permission on the terminal device file. The setting is per-terminal, not per-user. It is commonly used to prevent interruptions during focused work or when running full-screen terminal applications.
Syntax
mesg [option] [y|n]
Parameters
y: Allow other users to write to your terminal.n: Deny write access to your terminal.- No argument: Display the current state.
Common Options
-v,--verbose: Show the current state with a descriptive message.-h,--help: Display help and exit.
Examples
mesg
Show the current terminal write status: is y or is n.
mesg n
Disable write access to the terminal.
mesg y
Re-enable write access.
mesg -v
Display the current state with write access is enabled/disabled.
Practical Notes
- The
wallcommand can still send broadcasts to all terminals regardless ofmesg n. - Root can always write to any terminal regardless of its
mesgsetting. - Some terminal multiplexers (tmux, screen) manage terminal permissions independently.
- Default settings vary by distribution; many set
mesg non SSH sessions by default. - The
$HOME/.profileor$HOME/.bashrcis a common place to setmesgpreferences.